Skip to content

Read access for group/everyone is allowed on ConsoleHost_history.txt file by default. #6679

@MichaelStankiewicz

Description

@MichaelStankiewicz

Steps to reproduce

NOTE: This issue was only validated on Linux (RHEL7) but could potentially be an issue on Windows as well, depending on how the history file is stored/used.

Install pwsh, and perform an ls -l on the following file:

~/.local/share/powershell/PSReadLine/ConsoleHost_history.txt

Expected behavior

Only the owner should have access to read this file.  In it's current configuration, in addition to the owner, both group/everyone can also read this file.  Due to the content of this file, only the owner should have read rights by default.  With the current permission structure, a threat actor could read/replay the command history and use it for malicious purposes.  

The CHMOD file map should be set to 700 or 600 by default.

Actual behavior

By default the CHMOD access map on this file is: 664

The above file map grants the owner R/W, the group R/W, and everyone R.

Environment data

> Name                           Value
----                           -----
PSVersion                      6.0.0
PSEdition                      Core
GitCommitId                    v6.0.0
OS                             Linux 3.10.0-693.11.6.el7.x86_64 #1 SMP Thu Dec 28 14:23:39 EST 2017
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-ExternalThe issue is caused by external component(s).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions