Try   HackMD

HTTP Parameter Pollution (HPP) 同名的 http 變數名稱

介紹

HTTP Parameter Pollution (HPP) Attacks 是一種利用同名的變數名稱進行攻擊的方法,此類行為在某些網頁應用程式防火牆(WAF)中稱為 Duplicate Parameter Name
當同名變數時,不同的網頁伺服器會有不同的結果(串接、取第一個、取最後一個),攻擊者可以利用這個方法達成 竄改變數內容 或 繞過敏感字串的防禦機制

實作方式

例如在google搜尋引擎上,先輸入123的字串,再於網址列q=123後面補上&q=456,可以看到搜尋結果會將 123 456 串在一起搜尋

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

不同程式語言/主機的回應機制

不同的程式語言或主機對重複變數的處理機制都不同,請參考下表

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

from:https://www.owasp.org/images/b/ba/AppsecEU09_CarettoniDiPaola_v0.8.pdf

如果是node.js,會拿到如同Python/Zope的陣列型態

攻擊產生的影響

  • 複寫變數
    php、jsp都不會取所有的變數,所以可以 "多串一個同名變數" 來複寫原本的變數

  • 修改行為、存取變數
    實作方式如前述的複寫變數,複寫變數後可修改原本的行為

  • 繞過輸入驗證
    如果有一段sql injection是這樣,程式的安全驗證模組通常可以擋下來

/index.aspx?page=select 1,2,3 from table

但是拆開後改寫後,就有可能繞過某些寫的不夠完整的驗證模組

/index.aspx?page=select 1&page=2,3 from table 
  • 繞過身分驗證
    使用複寫變數的方式達成,在 blogger 曾發現這個漏洞,例如這串語法,可以讓 attacker (未經授權的使用者)取得 victim (受害者)的 blogger 存取權
POST /add-authors.do HTTP/1.1

security_token=attackertoken&blogID=attackerblogidvalue&blogID=victimblogidvalue&authorsList=goldshlager19test%40gmail.com(attacker email)&ok=Invite

參考文件

Testing for HTTP Parameter pollution (OTG-INPVAL-004)
https://kennel209.gitbooks.io/owasp-testing-guide-v4/en/web_application_security_testing/testing_for_http_parameter_pollution_otg-inpval-004.html

How to Detect HTTP Parameter Pollution Attacks
https://www.acunetix.com/blog/whitepaper-http-parameter-pollution

HTTP Parameter Pollution
https://www.imperva.com/learn/application-security/http-parameter-pollution/

資安JAVA(二二): HTTP Parameter Pollution
http://likewaylai.blogspot.com/2012/06/java-http-parameter-pollution.html

Bypassing WAF via HTTP Parameter Pollution
http://danuxx.blogspot.com/2012/10/bypassing-waf-via-http-parameter.html

What is HTTP Parameter Pollution attack in NodeJS/ExpressJs
https://stackoverflow.com/questions/30672500/what-is-http-parameter-pollution-attack-in-nodejs-expressjs

tags: 資安