CG CTF WEB SQL注入2
生活随笔
收集整理的這篇文章主要介紹了
CG CTF WEB SQL注入2
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
http://4.chinalover.sinaapp.com/web6/index.php
題解:
<html> <head> Secure Web Login II </head> <body><?php if($_POST[user] && $_POST[pass]) {mysql_connect(SAE_MYSQL_HOST_M . ':' . SAE_MYSQL_PORT,SAE_MYSQL_USER,SAE_MYSQL_PASS);mysql_select_db(SAE_MYSQL_DB);$user = $_POST[user];$pass = md5($_POST[pass]);$query = @mysql_fetch_array(mysql_query("select pw from ctf where user='$user'"));if (($query[pw]) && (!strcasecmp($pass, $query[pw]))) {echo "<p>Logged in! Key: ntcf{**************} </p>";}else {echo("<p>Log in failure!</p>");} } ?><form method=post action=index.php> <input type=text name=user value="Username"> <input type=password name=pass value="Password"> <input type=submit> </form> </body> <a href="index.phps">Source</a> </html>1.用post方法輸入兩個變量
2.輸入的變量pass的值經過MD5加密了
3.中存儲的是sql命令的結果集
4.如果變量存在,并且,$pass與$query[pw]相等(不區分大小寫)
所以我們考慮在$user上加上一個union語句,即向$query的結果集中在加一條,同時能夠使得條4成d立的4
注意需要在union前加一個 ' 用于閉合'$uesr'前的那個引號,#是為了注釋點后面的那個引號,輸入的pass=1對應md5(1),
版本一
版本二
總結
以上是生活随笔為你收集整理的CG CTF WEB SQL注入2的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CG CTF WEB SQL注入1
- 下一篇: CG CTF WEB 上传绕过