UJP - MSペイントでcmdやpowershellを実行するというテクニック

Life is fun and easy!

不正IP報告数

Okan Sensor
 
メイン
ログイン
ブログ カテゴリ一覧

  • カテゴリ セキュリティ の最新配信
  • RSS
  • RDF
  • ATOM

ブログ - MSペイントでcmdやpowershellを実行するというテクニック

MSペイントでcmdやpowershellを実行するというテクニック

カテゴリ : 
セキュリティ » ツール
ブロガー : 
ujpblog 2023/2/10 2:36
 Twitterを見ていたら流れてきたので試してみた.

HOW TO LAUNCH COMMAND PROMPT AND POWERSHELL FROM MS PAINT
https://tzusec.com/how-to-launch-command-prompt-and-powershell-from-ms-paint/

引用:
This guide will show you how you can launch cmd and Powershell with help from Microsoft Paint. Sometimes organisations environments are being locked down and are preventing users from right clicking and opening tools such as cmd.exe or powershell.exe. When I face that during a penetration test I usually try this simple mspaint hack to check if I can get around the organisations defensive measures.

このガイドでは、Microsoft Paintの助けを借りてcmdやPowershellを起動する方法を紹介します。組織の環境がロックされ、ユーザーが右クリックしてcmd.exeやpowershell.exeなどのツールを開くことができない場合があります、侵入テストでこのような状況に直面した場合、私は通常、このシンプルなmspaintハックを試して、組織の防御策を回避できるかどうかを確認します。



・MSペイントで6ドット分のキャンバスを作ってドット編集
・1ドットづつ指定のRGB番号の色をつける
・24itのBMPとしてファイルを保存してファイル名をbatにする
・コマンドプロンプトで作成したbatファイルを実行.

 実行してみたらこのような感じ.

 色合いを間違えたかな? でもcmd.exeが実行されている.

 作成したbatファイルをメモ帳で開いてみる.


 なるほど.バイナリデータが丁度テキストコードになるということか.6ピクセル


引用:
What we do is changing the color of the six pixels so that they in heaxdecimal represents ‘cmd.exe’/’powershell’. When we save the file to .BMP the encoding algorithm converts the RGB colors to ASCII data. When that is done and we change the file format to .BAT the .BAT script containts the instruction ‘cmd.exe’/’powershell’ that will be executed when we double click on the script.


6つのピクセルの色を変えて、16進数で「cmd.exe」/「powershell」を表現しています。ファイルを.BMPに保存すると、エンコーディングアルゴリズムがRGBカラーをASCIIデータに変換します。これが終わってファイル形式を.BATに変えると、.BATスクリプトには「cmd.exe」/「powershell」という命令が含まれており、このスクリプトをダブルクリックすると実行される。


 テキストエディタを使わずにcmdやpowershellを作ることができることはわかったけれど,作者の言う「ユーザーが右クリックしてcmd.exeやpowershell.exeなどのツールを開くことができない」環境で,ユーザ作成のbatファイルが実行できるというのがわからん.

トラックバック


広告スペース
Google