Advertisement
aaka

HTTP HEADER ATTACK - Part 1

Jul 15th, 2015
4,109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.86 KB | None | 0 0
  1. Hello friends.I am CodeNinja a.k.a. Aakash Choudhary.
  2.  
  3. As I promised to make tutorial on HTTP HEADER ATTACK to my friend Tayyab Qadir [Leet Kid :P] so now i am making this
  4. tutorial so keep watch and learn Thanks.
  5.  
  6. If you want to learn this attack you should understand HTTP first. Here is some important sites :->
  7.  
  8. 1. http://code.tutsplus.com/tutorials/http-the-protocol-every-web-developer-must-know-part-1--net-31177
  9. 2. http://code.tutsplus.com/tutorials/http-the-protocol-every-web-developer-must-know-part-2--net-31155
  10. 3. http://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html
  11. 4. http://code.tutsplus.com/tutorials/using-web-debugging-proxies--net-29828
  12. 5. http://www.sans.org/reading-room/whitepapers/testing/penetration-testing-web-application-dangerous-http-methods-33945
  13. 6. http://learn.onemonth.com/understanding-http-basics
  14. 7. https://danielmiessler.com/study/http/
  15.  
  16. All above are very very awesome for understand HTTP.
  17.  
  18. Step 1:- What is HTTP & cause or harm by this attack ?
  19.  
  20. ANS :- Web servers often broadcast server information by default.
  21. This can include information such as the operating system (Linux, Windows, etc),
  22. the operating system version, what kind of web server you are running (IIS, Apache, etc.) and
  23. in some cases web server modules installed.
  24.  
  25. This information is stored in http headers, and sent along with every web page request made by a user visiting your page.
  26.  
  27. As a result, it is very easy for anyone to find out what kind of settings such a server is using.
  28.  
  29. By itself, this information is harmless, although it does give away some information about your website setup.
  30.  
  31. A dedicated attacker can use this information to find and craft attacks specific to your system,
  32.  
  33. or automated attacks may search for specific configurations to attack.
  34.  
  35. Although it is difficult to prevent someone from finding this information using other methods,
  36. disabling server headers reduces the likelihood of attacks on the site.
  37.  
  38. I know how to secure website from this attack :D but not much full but atleast i know :P
  39.  
  40.  
  41.  
  42.  
  43. Step 2:- How many ways there to attack on HTTP ?
  44.  
  45. ANS :- Here what i saw on this attack possible :-
  46.  
  47. 1. HTTP REQUEST SMUGGLING :- Cache Poisoning,Session Hijaking,XSS
  48. 2. HTTP RESPONSE SPLITTING :- Cross-User Defacement,Cache Poisoning,XSS,Page Hijacking
  49. 3. HTTP Parameter Polution Attack
  50. We must know about Header types in HTTP & Status Code like 200,301,404
  51.  
  52. Must to know Important Headers :- https://www.owasp.org/index.php/List_of_useful_HTTP_headers
  53.  
  54. We must know about HTTP Methods :-
  55. -------------------------------------------------
  56. GET
  57. POST
  58. TRACE
  59. DELETE
  60. PUT
  61. HOST
  62. X-FORWARDED-FOR
  63. Referer
  64. User-agent
  65. HTTPOnly
  66. OPTIONS
  67. CONNECT
  68.  
  69.  
  70. NOTE: If we while inspecting HTTP see this :- Allow: GET,HEAD,POST,TRACE,OPTIONS Then it is good news for us because
  71. now we know that what methods are allow in target website and we can do many attacks based on this :D.
  72.  
  73. Most applications only use few HTTP headers:
  74.  
  75. Referer: to know where the clients come from
  76. Cookie: to retrieve the cookies
  77. User-Agent: to know what browser users use like :Mozilla
  78. X-Forwarded-For: to get the source IP address (even if it's not the best method to do this).
  79.  
  80. The Host header is mainly used by the web server to know what web site you are trying to access
  81. If we put the IP address in the Host header or an invalid hostname, we can sometimes get another website and
  82. get extra-information from this.
  83.  
  84. ------------------------------------------------
  85.  
  86. Requirements :-
  87. -------------------------------------------------
  88. 1. RefControl addon
  89. 2. User-Agent Switcher
  90. 3. Netcat
  91. 4. Wireshark
  92. 5. TELNET
  93. 6. NMAP
  94. 7. HTTP HEADERS
  95. 8. Burpsuite
  96.  
  97. We should have understanding of above things.
  98. --------------------------------------------------
  99.  
  100.  
  101.  
  102. STEP 3:- Identify Vulnerability
  103.  
  104. ANS:- Check everything to detect vulnerability in any website. Like to identify HTTP HEADER ATTACK vulnerability on
  105. website just open site and check its REQUEST & RESPONSE in Headers. We can use WIRESHARK,BURPSUITE or HEADER addons
  106.  
  107. LIKE :-
  108. Web applications that do not properly sanitize user input before using it as an HTTP header value are vulnerable
  109. to header injection (also called Response Splitting).
  110.  
  111. Now i am explaining ===> HTTP HEADER ATTACK
  112.  
  113. HTTP headers have the structure “Key: Value”, where each line is separated by the CRLF combination.
  114. If the user input is injected into the value section without properly escaping/removing CRLF characters
  115. it is possible to alter the HTTP headers structure.
  116. A CRLF (New line) injection adding malicious characters into HTTP headers without proper input filtering.
  117.  
  118. HTTP Response Splitting is a application attack technique which enables various new attacks
  119. such as web cache poisoning, cross user defacement, hijacking pages with sensitive user information and XSS.
  120. The attacker sends a single HTTP request that forces the web server to form an output stream,
  121. which is then interpreted by the target as two HTTP responses instead of one response.
  122.  
  123.  
  124. You see CRLF combination. What is this ? This is :- Carriage Return (\n) + Line Feed(\r)
  125.  
  126. So what is actually HTTP ? This is a Protocol which is used to communicate between Our Browser and Web Server.
  127. REQUEST & RESPONSES is what important thing in HTTP.
  128.  
  129. HTTP Request :- When we fill form anc click SUBMIT button then it goes to Web Server where Web Server check is that
  130. filling form is correct or not so this is called REQUEST.
  131.  
  132.  
  133. HTTP RESPONSE :- So when Web Server show us message like Form is submitted or if we login successfully then we login
  134. on page so this is what Web Server give Response of what we Request.
  135.  
  136. So if we fill log in details by inputing our name & password and then INSPECTING HTTP using tools like BURPSUITE or
  137. HTTP HEADER addons and see is our input is not sanitizing by web server then we can Attack :P
  138.  
  139.  
  140.  
  141. GENERATE HTTP TRAFFIC :-
  142.  
  143. We can use telnet or netcat for this purpose
  144.  
  145. e.g. :-
  146.  
  147. 1. telnet 192.168.56.102/vulnerable 80
  148. GET / HTTP/1.1
  149. Host: 192.168.56.102/vulnerable
  150.  
  151. NOTE: Some time we see 400 Bad Request so we can also try this HTTP/1.0 instead of HTTP/1.1
  152.  
  153. 2.Also can use this
  154. echo "GET /HTTP/1.0\r\nHost:vulnerable\r\n\r\n" | nc vulnerable 80
  155.  
  156. Where \r\n is our CRLF Remember I discussed about this already above :P
  157. We can also use %0d or %0a instead of \r or \n respectively
  158.  
  159.  
  160. We can use many important things like HTML ENCODING,DOUBLE ENCODING,URL ENCODING because somethimes it can be very
  161. HELPFUL :D
  162.  
  163. 3. Also we can try with JEFF method instead of GET. If you try with JEFF method and see Response 200 OK then it is
  164. vulnerable with JEFF method BUT if we see 405 or 501 error then JEFF method not work.
  165.  
  166. 4.HOST :- It is a header that allows a web server to host multiple websites on the same IP address
  167.  
  168.  
  169.  
  170.  
  171.  
  172. ############################# HTTP REQUEST #############################
  173.  
  174. This is what happens when you open your browser and navigate to www.google.com.
  175. An HTTP request to www.google.com is initiated.
  176. GET / HTTP/1.1
  177. Host: www.goole.com
  178. Accept: text/html
  179. User-Agent: Mozilla/5.0 (Windows; U;
  180. Windows NT 6.1; it; rv:1.9.2.2)
  181. Gecko/20100316 Firefox/3.6.2 GTBDFff
  182. GTB7.0
  183. Connection: keep-alive
  184.  
  185. What we see here are the Headers, called HTTP Request Headers for this request.
  186.  
  187. Now lets understand the above Requests one by one.
  188.  
  189. 1.) GET / HTTP/1.1 ---> Request Method
  190. This is the type of our request (also known as HTTP Verb).
  191. GET is the request type when we type a website URL in our location bar and hit enter.
  192. Other Verbs are POST, PUT,DELETE, OPTIONS, TRACE etc etc
  193.  
  194.  
  195. 2.) / ---> Path
  196. This is the file we are requesting.
  197. The home page of a website is always "/".
  198.  
  199. Other pages can be requested such as: /downloads/index.php.
  200.  
  201. We always refer to the root folder to specify the requested file (hence the leading "/").
  202.  
  203.  
  204. 3.) HTTP/1.1 ---> Protocol
  205. This is the HTTP protocol version our browser is talking.
  206. This basically hints the web server which language will be used in the communication
  207.  
  208. 4.) Host: www.google.com ---> Host header
  209. This is the beginning of HTTP Request Headers.
  210. HTTP Headers have the following structure: Header-name:Header-value.
  211.  
  212. The Host header allows a web server to host multiple websites on the same IP address.
  213.  
  214. This means that we will have to specify which website we are interested in, in the Host header.
  215.  
  216. www.google.com <---- This is Host Value
  217.  
  218. After each Request header we find its corresponding value.
  219. In this case we want to reach the host --> www.google.com.
  220.  
  221. Note: Host value + Path makes the full URL we are requesting: The home page of www.google.com.
  222.  
  223. 5.) Accept: text/html ----> Accept Header
  224. This header is used by the browser to specify which document type is expected as the result of this request.
  225.  
  226.  
  227. 6.) User-Agent: Mozilla/5.0 (Windows; U;
  228. Windows NT 6.1; it; rv:1.9.2.2)
  229. Gecko/20100316 Firefox/3.6.2 GTBDFff
  230. GTB7.0
  231.  
  232. -----> Host User Agent
  233.  
  234. The user agent reveals the browser version, operating system and language to the remote web server.
  235. All web browsers have their own identification user agent.
  236. This is how most web site recognize the type of browser in use.
  237.  
  238.  
  239. 7.) Connection: keep-alive ----> Header Connection
  240. With HTTP 1.1 we can keep our connection to the remote web server open for a given time using the value "Keep-alive".
  241.  
  242. All the requests to the web server will go through this connection
  243. without reinstating a new connection every time (as in HTTP 1.0).
  244.  
  245. ################################################################################################################
  246.  
  247. ###################### HTTP RESPONSE ##########################
  248.  
  249. In response to the HTTP Request,
  250. the web server will respond with the requested resource preceded by a number of Headers.
  251.  
  252. These headers will be used by the web browser to interpret the content carried in the Response content.
  253.  
  254. Check these in HEADERS ===>
  255.  
  256. 1.) Cache-Control: private,max-age=0 ==========> Cache Header
  257.  
  258. The cache headers allow the Browser and the Server to exchange information about cached contents.
  259.  
  260. Cached contents save bandwidth because prevent the browser from requesting unmodified contents when the
  261. same resource is to be used.
  262.  
  263. 2.) Server:gws ========> Server Header
  264.  
  265. The Server header advertises the banner of the Web Server. Apache and IIS are common web servers.
  266.  
  267. In above example Google uses a custom webserver banner as "gws" (Google
  268. Web Server).
  269.  
  270.  
  271. 3.) Via: 1.0 .:8001(squid) ======> Via Header
  272.  
  273. The Via header is present when a connection has traversed a proxy.
  274. A proxy is a special web server that caches contents for faster delivery
  275.  
  276. 4.) <PAGE CONTENT> =====> Content
  277.  
  278. This is the content of the requested resource.
  279. The content can be a web page html, a document, or a binary file.
  280. The type of content is contained in the Content-type header.
  281.  
  282.  
  283.  
  284.  
  285.  
  286. Take a look on HTTP Response Splitting Attack :-
  287.  
  288. ############################### HTTP RESPONSE SPLITTING #########################################
  289.  
  290. The idea behind it is, you find a website that takes user submitted data, and writes it to the HTTP header.
  291. An example of this is a Location: redirect. Heres the PHP code that takes a website, and redirects you to it.
  292.  
  293. http://site.com/redirect.php?page=http://www.google.com
  294.  
  295. <?php
  296. header("Location: $_GET['page']");
  297. ?>
  298.  
  299. In this attack we have to see Response COdes like 200 OK,404,302 etc etc.
  300.  
  301. SCENARIO :-
  302. Consider a server which accepts user input through some form or search or anything which is sent as POST data.
  303. The server does not sanitize the user input, allowing the user to enter any arbitrary data.
  304. Each line in HTTP header is separated by CR/LF.
  305. CR means carriage return and LF means line feed, this is crucial while parsing because it tells the end of line.
  306.  
  307. The attacker cleverly crafts another request inside the input field.
  308. Suppose in headers if we see " lang=en " has user influence, so the attacker can send data as :
  309.  
  310. 1. The value ‘en’.
  311. 2. CR/LF – %0d%0a for Windows or %0a for Linux
  312. 3. A response with Content Length 0 [we don’t bother about this response.]
  313. 4. CR/LF – %0d%0a for Windows or %0a for Linux
  314. 5. A response which contains malicious content
  315. [For e.g. Javascript which will download malware when the page is visited]
  316.  
  317. Note :- If we are WINDOWS user we use CR/LF & if we are LINUX user we use LF
  318.  
  319.  
  320. What we can do with HTTP Response Splitting Attack ? ---->
  321. – Cross-site Scripting (XSS) attacks
  322. – Cross User Defacement
  323. – Web Cache Poisoning
  324. – Page Hijacking
  325. – Browser Cache Poisoning
  326. – Browser Hijacking
  327.  
  328.  
  329.  
  330. Now in next section i am including *ATTACK* section as example so that we learn more but remember i will teach
  331. practically attack in my 2nd Part of Tutorial.
  332.  
  333. ################# HTTP Response Splitting - The Attack examples ########################
  334.  
  335. • An HTTP message response includes two parts :
  336. – Message Headers – metadata that describes a request or response
  337. - Each terminated by a carriage return (\r) and a linefeed (\n) (But remember about OS like window or chrome)
  338.  
  339. GET http://www.google.com/ HTTP/1.1\r\n
  340. Host: www.google.com\r\n
  341. User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
  342. rv:1.9.0.1; Google-TR-5.7.806.10245-en) Gecko/2008070208
  343. Firefox/3.0.1 Paros/3.2.13\r\n
  344. Accept: text/html,application/xhtml+xml,application/xml;
  345. q=0.9,*/*;q=0.8\r\n
  346. Accept-Language: en-us,en;q=0.5\r\n
  347. Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n
  348. Keep-Alive: 300\r\n
  349. Proxy-Connection: keep-alive\r\n
  350.  
  351. Please notice \r\n there :D
  352.  
  353. • Then the Message Body which is the raw data of the response
  354. <HTML>\r\n
  355. <HEAD>\r\n
  356. <TITLE>Your Title Here</TITLE>\r\n
  357. </HEAD>\r\n
  358. <BODY>\r\n
  359. </BODY>\r\n
  360. ...
  361. </HTML>\r\n
  362.  
  363.  
  364.  
  365. • The Message Headers are also separated from the message body a carriage return/linefeed pair
  366. GET http://www.google.com/ HTTP/1.1 \r\n
  367. Host: www.google.com \r\n
  368. User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1; Google-TR-
  369. 5.7.806.10245-en) Gecko/2008070208 Firefox/3.0.1 Paros/3.2.13 \r\n
  370. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 \r\n
  371. Accept-Language: en-us,en;q=0.5 \r\n
  372. Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 \r\n
  373. Keep-Alive: 300 \r\n
  374. Proxy-Connection: keep-alive \r\n
  375. \r\n
  376. <HTML>
  377. <HEAD>
  378. <TITLE>Your Title Here</TITLE>
  379.  
  380.  
  381.  
  382. • Those two consecutive carriage-return-linefeed pairs are the source of
  383. HTTP response splitting vulnerabilities
  384. • The HTTP response splitting vulnerability is not the attack, it is simply the
  385. path that makes it possible
  386. • The key to the attack is ability for an attacker to modify the message
  387. headers
  388. • HTML is stateless, so neither the web server nor the browser has any
  389. problem with this seemingly odd behavior
  390.  
  391.  
  392.  
  393. ------------------------------------------------------------------------------------------
  394.  
  395. • Now Let’s understand how a normal page redirection works in HTTP
  396. – Example: A page containing a redirect script:
  397.  
  398. protected void processRequest(HttpServletRequest aRequest, HttpServletResponse
  399. aResponse) throws ServletException, IOException {
  400. redirect(“http://www.new-url.com”, aResponse);
  401. }
  402. – A request like:
  403. – would redirect to:
  404. http://www.test.com/offer.jsp?page=http://www.test.com/freechecking
  405. – How do the headers work behind the scenes?
  406. http://www.test.com/freechecking
  407.  
  408. • Under the hood, the request is ->
  409. GET /latestoffer.jsp?page=http://www.test.com/freechecking HTTP/1.1\r\n
  410. Host: www.bank.com \r\n
  411. ...
  412. \r\n
  413.  
  414. • The server responds with an HTTP 302 (redirect)
  415. HTTP/1.1 302 Found \r\n
  416. ...
  417. Location: http://www.test.com/freechecking \r\n
  418. NOTE: THIS COULD BE THE USER INPUT IN HEADER
  419. ...
  420. \r\n
  421.  
  422. • The browser then fetches the new page
  423. GET / HTTP/1.1 \r\n
  424. Host: http://www.test.com/freechecking \r\n
  425. ...
  426. \r\n
  427.  
  428. • The server responds with HTTP 200 (found) and the page
  429. HTTP/1.1 200 OK \r\n
  430. ...
  431. \r\n
  432.  
  433. • But the user can input something that terminates the response and initiates an attack
  434.  
  435. For Window user :-
  436. /latestoffer.jsp?page=anything%0d%0aContent-
  437. Length:%200%0d%0d%0a%0aHTTP/1.1%20200%20OK%0d
  438. %0aContent-Type:%20text/html%0d%0a
  439. Content-Length:%2019%0d%0a%0d%0a<html>Attack</html>
  440.  
  441. For Linux User :-
  442.  
  443. /latestoffer.jsp?page=anything%0aContent-
  444. Length:0%0a%0aHTTP/1.1 200 OK
  445. %0aContent-Type: text/html %0a
  446. Content-Length: 19%0a%0a<html>Attack</html>
  447.  
  448. URL Encoded is important --->
  449. - ":" by %3A
  450. - "space" by %20
  451. - "carriage return" by %0A
  452. - "," by %2c
  453. - "/" by %2F
  454. - "<" by %3C
  455. - ">" by %3E
  456.  
  457. Use this site for this purpose :- http://yehg.net/encoding/
  458.  
  459. Now come to the that attack example again :-
  460.  
  461. /latestoffer.jsp?page=anything%0d%0aContent-
  462. Length:%200%0d%0d%0a%0aHTTP/1.1%20200%20OK%0d
  463. %0aContent-Type:%20text/html%0d%0a
  464. Content-Length:%2019%0d%0a%0d%0a<html>Attack</html>
  465.  
  466. There notice -> Content-Length:%2019%0d%0a%0d%0a<html>Attack</html>
  467. - Remember that we need two \r\n sequences between the headers and the body
  468.  
  469.  
  470. This results in ---->
  471. HTTP/1.1 302 Moved Temporarily
  472.  
  473. Location: http://www.test.com/latestoffer.jsp?page=anything <--- HTTP RESPONSE
  474. Content Length: 0
  475. HTTP/1.1 200 OK ---------|
  476. Content-Type: text/html | We INSERTED HTTP Response
  477. Content-Length: 19 |
  478. <<Anything you want>> ---------|
  479.  
  480. Then :-
  481. Server: gws ---------|
  482. Content-Type: text/html | This is what Superfluous Data mean which is our expecting data
  483. Content-Length:%2019 |
  484. <html>Attack</html> |
  485. ..... ---------|
  486.  
  487.  
  488.  
  489. Explanation :-
  490. • The dangerous part of this, is <<Anything you want>>
  491. • A script that can take over the user's browser or steal cookie information
  492. – A redirection to a different host and web page
  493. – A page that mimics another site and collect credentials
  494. – It can poison the web cache leading to site defacement
  495. • However, the exploit is not complete
  496. • There are now two responses, but only one request
  497. • The web server will simply hold the second response
  498. • The attacker has to issue another request
  499. • In the simplest case, simply send http://www.test.com
  500. • How the attacker does this is dependent on the situation and the attackers goals
  501.  
  502. See the following example of cache poisoning -->
  503.  
  504. First Understand :->
  505. – A site has a proxy server for web pages
  506. – The attacker and victims are behind the proxy server
  507. – When a response is received by the proxy server, it saves it to answer future requests
  508. – So the proxy server saves both responses from the attack
  509. – If the second response defaces a real page, or creates a page with a malicious
  510. JavaScript embedded, everyone on the network will get it
  511.  
  512. Second - Browser Cache Poisoning :->
  513. • We creates an HTTP Response Splitting attack based on a URL
  514. http://somesite.com/start.php?first=xxx<script> ...
  515. </script>&lang=fr%0d%0aContent-Length:0%0d%0a
  516. HTTP/1.1%20200%20Found%0d%0aContent-
  517. Length:550%0d%0a ...
  518.  
  519. • and seduces a victim into clicking on it
  520. • The web servers first response contains a Cross-site Scripting attack
  521. • The script issues an Ajax request that sends the second request
  522. • And the victim’s web cache (and any proxy server) is poisoned
  523.  
  524.  
  525.  
  526.  
  527.  
  528. Now the main question arise in every's mind is that how we can DISCOVER this attack? Yeah i know i know but don't
  529. worry. I am here to tell you this too.So lets start :
  530.  
  531.  
  532. ************************ HTTP Response Splitting Discovery ****************************
  533.  
  534. • Check for any data outside of the Trust Boundary that is used in any HTTP header
  535. – Try inserting a carriage return/linefeed pair i.e. \r(%0a) or \n(%20) to see it is allowed to pass through
  536. – If so, we have a vulnerability
  537. – Be suspicious of redirects in code – they often use information stored in the client
  538.  
  539. • Be aware that Post data can also be used in an attack
  540. – It may be advantageous, because URL's have limited length
  541. – It requires that the attack be perpetrated via a script so it is more difficult to implement
  542.  
  543.  
  544.  
  545. Useful Resources :-
  546.  
  547. 1. https://www.mnot.net/cache_docs/
  548. 2. http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html <--- This is useful to understanding HTTP headers
  549.  
  550. ###################################################################################################################
  551.  
  552.  
  553.  
  554. ################################ HTTP REQUEST SMUGGLING (HRS) ###################################
  555.  
  556.  
  557. FROM OWASP :-
  558.  
  559. The HTTP Request Smuggling attack explores an incomplete parsing of the submitted data done by an
  560. intermediary HTTP system working as a proxy. HTTP Request Smuggling consists of sending a specially formatted
  561. HTTP request that will be parsed in a different way by the proxy system and by the final system,
  562. so the attacker could smuggle a request to one system without the other being aware of it.
  563. This attack makes it possible to exploit other attacks, like Cache Poisoning, Session Hijacking, Cross-site Scripting (XSS) and most importantly, the ability to bypass web application firewall protection.
  564.  
  565. HRS is can be used to poison web-caches and bypass security solutions such as web application firewalls
  566. as well as for the delivery of malicious payloads such as worms, viruses, and those used to exploit
  567. known vulnerabilities in web and application servers.
  568.  
  569.  
  570. OWASP is great to understand this attack as i read :- https://www.owasp.org/index.php/HTTP_Request_Smuggling
  571.  
  572.  
  573. If between Client and Server there is so many HTTP Devices/entities use like Cache Server,Proxy Server,WAF then
  574. HRS attack is very useful here.
  575.  
  576.  
  577. HRS sends multiple, specially crafted HTTP requests that cause the two attacked devices to see different
  578. sets of requests, allowing us as attacker to smuggle a request to one device without the other device being aware
  579. of it.
  580. It is capable of exploiting small differences in the way HTTP devices deal with illegitimate or borderline requests
  581.  
  582.  
  583. ###################################################################################################################
  584.  
  585.  
  586.  
  587. ####################### HTTP PARAMETER POLUTION (HPP) #############################
  588.  
  589.  
  590. To understand this attack we have to understand the Behaviour of WEB Technologies.Different web use different technologies.
  591. Like if you search " header attack " on GOOGLE then you get following result :-
  592. https://www.google.co.in/?gws_rd=ssl#q=header+attack ---> header attack
  593.  
  594. on YAHOO :-
  595. https://in.search.yahoo.com/search?p=header+attack&fr=yfp-t-704 ---> header attack
  596.  
  597.  
  598. Notice the parameter used by both GOOGLE & YAHOO
  599.  
  600. So in this attack our main task is to find out that is parameter vulnerable or not. Mean we have to analyze that
  601. is application does not sanitize the "PARAMETER" of website URL.
  602.  
  603. So this attack is generally use to bypass WAF (Web Application Firewall) by targeting on PARAMETERS.
  604.  
  605. As attacker we have to find out the unsanitize parameter of website. Like:-
  606. Consider this URL:- http://www.testsite.com/category=1&page=2&id=3
  607.  
  608. So there is 3 Parameters Developers used.
  609. - 1. category=1
  610. - 2. page=3
  611. - 3. id=3
  612. So as attacker we have to find out that which parameter out of those 3 is unsanitize so that we perform attack.
  613. If any of those parameters or all is not sanitize properly then we can perform attack there :D .
  614.  
  615. So HPP attacks on HTTP GET/POST parameters by injecting query string
  616.  
  617. One of example of HPP :- http://www.testsite.com/Injection=<script&injection=>alert(aakash)></script>
  618.  
  619.  
  620.  
  621.  
  622. FROM OWASP :-
  623. 1.Submit an HTTP request containing the standard parameter name and value, and record the HTTP response. E.g. page?par1=val1
  624.  
  625. 2.Replace the parameter value with a tampered value, submit and record the HTTP response. E.g. page?par1=HPP_TEST1
  626.  
  627. 3.Send a new request combining step (1) and (2). Again, save the HTTP response. E.g. page?par1=val1&par1=HPP_TEST1
  628.  
  629. 4.Compare the responses obtained during all previous steps. If the response from (3) is different from (1) and the response from (3) is also different from (2), there is an impedance mismatch that may be eventually abused to trigger HPP vulnerabilities.
  630.  
  631. Also for testing this vulnerability we should check Search Page not login page because ub term of Login page we may get
  632. Invalid Username or Password
  633.  
  634.  
  635.  
  636. You see we used & to seperate query, We can also use " ; "
  637.  
  638.  
  639. NOTE: It doesn't mean that we see these parameters in URL only. We can also see these parameters in HTTP Headers.
  640. LIKE :-
  641. - Cookie: par=1; par=2
  642.  
  643.  
  644. Very Good Resources :=>
  645. 1. https://www.owasp.org/images/b/ba/AppsecEU09_CarettoniDiPaola_v0.8.pdf
  646. 2. http://www.slideshare.net/embyte/http-parameter-pollution-vulnerabilities-in-web-applications-black-hat-eu-2011
  647. #####################################################################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement