<pre id="vvttv"><mark id="vvttv"><progress id="vvttv"></progress></mark></pre>
    <pre id="vvttv"></pre>

      <p id="vvttv"></p>

          <p id="vvttv"></p>

                <p id="vvttv"></p>

                <pre id="vvttv"><cite id="vvttv"><progress id="vvttv"></progress></cite></pre>

                  <output id="vvttv"><dfn id="vvttv"><th id="vvttv"></th></dfn></output>

                    <p id="vvttv"></p>

                    原文地址:http://drops.wooyun.org/web/5410

                    0x01 引言


                    前段時間搞站遇到了TRS的系統里面涉及到了ws(Web Services簡稱)的相關技術,不久前玩一個xx酒店的時候又通過ws進入了它的數據庫,后來接連遇到或看見一些app服務和物聯網相關系統中出現XML相關漏洞,于是搜索相關資料做技術積累。如果文中出現錯誤,望指正。 ? ??

                    0x02 什么是WS


                    Web Service是基于網絡的、分布式的模塊化組件,它執行特定的任務,遵守具體的技術規范,這些規范使得Web Service能與其他兼容的組件進行互操作。?Web Services 利用 SOAP 和 XML對這些模型在通訊方面作了進一步的擴展以消除特殊對象模型的障礙。Web Services 主要利用 HTTP 和 SOAP 協議使業務數據在 Web 上傳輸,SOAP通過 HTTP 調用業務對象執行遠程功能調用,Web 用戶能夠使用 SOAP 和 HTTP通過 Web 調用的方法來調用遠程對象的。(來至百度百科)。

                    簡單的說WS就是http + XML,WS平臺的元素有:SOAP、UDDI、WSDL。

                    0x03 xml注入(soap注入)


                    以下將介紹一些利用場景,漏洞是千變萬化的肯定不全,也不是每種環境都適用。

                    情景1:

                    漏洞:

                    #!html
                    <?xml version="1.0" encoding="UTF-8"?>
                    <USER role="guest">attacker's code</USER>
                    

                    poc:

                    #!html
                    A</USER><USER role="admin">B
                    

                    情景2:

                    漏洞:

                    enter image description here

                    改變了為空,通過返回錯誤發現loginid作為登陸判斷:

                    enter image description here

                    poc:

                    enter image description here

                    ?結果bypass登陸:

                    enter image description here

                    情景3:

                    #!html
                    <transaction>
                    ? ???<total>6000.00<total>
                    ? ???<credit_card_number>12345</credit_card_number> //12345可控,覆蓋<total>標簽
                    ? ???<expiration>01012008</expiration>
                    </transaction>
                    

                    poc:

                    #!html
                    12345</credit_card_number><total>1.00</total><credit_card_number>12345
                    

                    0x03 SQL注入和xpath注入


                    總所周知SQL注入,注入的是數據庫,作為owasp top10的漏洞,存在相當的普遍,ws中也同樣存在。wooyun上也同樣存在案例 WooYun: 安盛天平某平臺系統可被getshell第四彈,并存在注入 ,這種ws上的sql注入漏洞也是非常容易被忽略的。至于sql注入的利用,不用多少,不同數據庫不同注入手法,和我們常見的sql注入方法一樣,并無區別。

                    xpath注入,在wooyun上談論的很少,中文資料也不是很多。簡單的形容如果xml作為數據庫的話xpath講究相當與sql語句,因此如果服務器是用xml格式來存儲數據,我們用xpath來調用數據,當傳入參數過濾不嚴的時候,就可能照成xpath注入,當然xpath注入還有很多技巧和函數的使用以及和xxe結合使用之類的技巧,在此不多說。

                    舉一ws注入xpath利用場景:

                    #!html
                    <sopaenv:Body>
                    <web1:Login xmlns:web1="http://ws.ws.com/">
                    <username>abc</username>
                    <password>123</password>
                    </web1:Login>
                    </sopaenv:Body>
                    

                    假如正常的xpath查詢:

                    string(//Employee[username/text()='abc' and password/text()='123']/account/text())
                    

                    我們控制可以控制username或者password,輸入

                    ' or '1' = '1
                    

                    最后xpath查詢成為:

                    string(//Employee[username/text()='' or '1' = '1' and password/text()='' or '1' = '1']/account/text())
                    

                    繞過登陸,當讓xpath的利用不知如此,比如使用doc()函數讀取任意xml文件、使用doc()和xxe讀取任意文件。

                    0x04?DDOS和XXE


                    為什么會有DDOS和XXE呢,前面已經說過了ws可以看成xml和http的結合,因此XML相關漏洞也是可能會出現在ws之中的,關于xml中的DDOS和XXE都是各位大牛都做了很多分析:

                    DDOS上有:長數據DDOS、多標簽DDOS

                    例如:

                    #!html
                    <transaction>
                    ? ??? ?<total>6000.00<total>
                    ? ??? ?<credit_card_number>12345</credit_card_number>
                    ? ??? ?<credit_card_number>qqqq</credit_card_number>??
                    ? ??? ?<credit_card_number>qqqq</credit_card_number>??
                    ? ??? ?<credit_card_number>qqqq</credit_card_number>??
                    ? ???  <credit_card_number>qqqq</credit_card_number>??
                    ? ??? ?``````
                    ? ??? ?<expiration>01012008</expiration>
                    </transaction>
                    

                    xxe漏洞drops上已有文章:http://drops.wooyun.org/tips/5290,以及利用xxe漏洞DDOS,利用xxe漏洞SSRF、命令執行關于這連個漏洞推薦兩篇文章:《Having Fun with XML hacking》、《XML實體攻擊-從內網探測到命令執行步步驚心》

                    0x05 上傳漏洞


                    這兩個都是危害非常大的漏洞:

                    上傳漏洞,ws是可以上傳附件的,典型的例子就是trs上傳漏洞

                    WooYun: 安徽省公路管理網站任意文件寫入漏洞

                    0x06 總結


                    從上面的攻擊方式不難看出分為兩類:

                    因此漏洞利用形式多種多樣,不同場景會有不同利用方式結合使用或者是bypass,掌握基礎的知識才能在遇到的時候靈活運用。

                    0x07 引用


                    http://resources.infosecinstitute.com/soap-attack-2/

                    https://www.blackhat.com/presentations/bh-europe-07/Bhalla-Kazerooni/Whitepaper/bh-eu-07-bhalla-WP.pdf

                    https://www.owasp.org/index.php/Testing_for_Web_Services

                      <pre id="vvttv"><mark id="vvttv"><progress id="vvttv"></progress></mark></pre>
                      <pre id="vvttv"></pre>

                        <p id="vvttv"></p>

                            <p id="vvttv"></p>

                                  <p id="vvttv"></p>

                                  <pre id="vvttv"><cite id="vvttv"><progress id="vvttv"></progress></cite></pre>

                                    <output id="vvttv"><dfn id="vvttv"><th id="vvttv"></th></dfn></output>

                                      <p id="vvttv"></p>

                                      这里只有精品视频