PowerShell / PowerShell/PSScriptAnalyzer
Rule request: `AvoidSecureStringDisclosure`
まだ誰も着手していません。
- 主要言語
- C#
- スター
- 2.2k
- フォーク
- 414
- 平均マージ
- 13時間 1分
- マージ済み PR(30日)
- 2
説明
As for AvoidUsingConvertToSecureStringWithPlainText it should be avoided to retrieve a PlainText password from a SecureString as it might leave memory trials (or even logging trails).
$Password = $SecureString | ConvertFrom-SecureString -AsPlainText
Besides, the action that follows and requires the plaintext password is likely vulnerable from a security aspect.
This will also include the common used statements as:
(see: https://stackoverflow.com/a/28353003/1701026)
$SecurePassword = ConvertTo-SecureString $PlainPassword -AsPlainText -Force
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecurePassword)
$Password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
[Runtime.InteropServices.Marshal]::ZeroFreeBSTR($BSTR)
and (see: https://stackoverflow.com/a/40166959/1701026):
$Password = (New-Object PSCredential 0, $SecurePassword).GetNetworkCredential().Password
The general approach of dealing with credentials is to avoid them and instead rely on other means to authenticate, such as certificates or Windows authentication.
Proposed technical implementation details (optional)
Create rules to check for the above mentioned unsafe statements.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず既存の PSScriptAnalyzer ルールの実装とテストを見つけ、ConvertFrom-SecureString、SecureStringToBSTR、PSCredential.GetNetworkCredential() の扱いを比較します。安全でない SecureString-to-plaintext パターンが確実に報告され、対応するアナライザーのテストが issue の例をカバーすれば、作業は完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp, powershell
- 領域
- security, tooling
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100