19.08.2015 Views

4.0

1IZ1TDd

1IZ1TDd

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

92Web Application Penetration Testingwhich public documents a registered user downloads) it is essentialthat a different Session ID is used. The Session ID shouldtherefore be monitored as the client switches from the secure tonon-secure elements to ensure a different one is used.Result Expected:Every time the authentication is successful, the user should expectto receive:• A different session token• A token sent via encrypted channel every time they make anHTTP RequestTesting for Proxies & Caching vulnerabilities:Proxies must also be considered when reviewing application security.In many cases, clients will access the application throughcorporate, ISP, or other proxies or protocol aware gateways (e.g.,Firewalls). The HTTP protocol provides directives to control thebehavior of downstream proxies, and the correct implementationof these directives should also be assessed.In general, the Session ID should never be sent over unencryptedtransport and should never be cached. The application should beexamined to ensure that encrypted communications are both thedefault and enforced for any transfer of Session IDs. Furthermore,whenever the Session ID is passed, directives should be in place toprevent its caching by intermediate and even local caches.The application should also be configured to secure data in cachesover both HTTP/1.0 and HTTP/1.1 – RFC 2616 discusses the appropriatecontrols with reference to HTTP. HTTP/1.1 provides a numberof cache control mechanisms. Cache-Control: no-cache indicatesthat a proxy must not re-use any data. Whilst Cache-Control: Privateappears to be a suitable directive, this still allows a non-sharedproxy to cache data. In the case of web-cafes or other shared systems,this presents a clear risk. Even with single-user workstationsthe cached Session ID may be exposed through a compromise ofthe file-system or where network stores are used. HTTP/1.0 cachesdo not recognise the Cache-Control: no-cache directive.Result Expected:The “Expires: 0” and Cache-Control: max-age=0 directives shouldbe used to further ensure caches do not expose the data. Eachrequest/response passing Session ID data should be examined toensure appropriate cache directives are in use.Testing for GET & POST vulnerabilities:In general, GET requests should not be used, as the Session IDmay be exposed in Proxy or Firewall logs. They are also far moreeasily manipulated than other types of transport, although itshould be noted that almost any mechanism can be manipulatedby the client with the right tools. Furthermore, Cross-site Scripting(XSS) attacks are most easily exploited by sending a speciallyconstructed link to the victim. This is far less likely if data is sentfrom the client as POSTs.Result Expected:All server side code receiving data from POST requests should betested to ensure it does not accept the data if sent as a GET. Forexample, consider the following POST request generated by a login page.POST http:/owaspapp.com/login.asp HTTP/1.1Host: owaspapp.comUser-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;rv:1.0.2) Gecko/20030208 Netscape/7.02 Paros/3.0.2bAccept: */*Accept-Language: en-us, enAccept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66Keep-Alive: 300Cookie: ASPSESSIONIDABCDEFG=ASKLJDLKJRELKHJGCache-Control: max-age=0Content-Type: application/x-www-form-urlencodedContent-Length: 34Login=Username&password=Password&SessionID=12345678If login.asp is badly implemented, it may be possible to log in usingthe following URL: http: /owaspapp.com/login.asp?Login=Username&password=Password&SessionID=12345678Potentially insecure server-side scripts may be identified bychecking each POST in this way.Testing for Transport vulnerabilities:All interaction between the Client and Application should be testedat least against the following criteria.• How are Session IDs transferred? e.g., GET, POST, Form Field(including hidden fields)• Are Session IDs always sent over encrypted transport by default?• Is it possible to manipulate the application to send Session IDsunencrypted? e.g., by changing HTTP to HTTPS?• What cache-control directives are applied to requests/responsespassing Session IDs?• Are these directives always present? If not, where are theexceptions?• Are GET requests incorporating the Session ID used?• If POST is used, can it be interchanged with GET?ReferencesWhitepapers• RFCs 2109 & 2965 – HTTP State Management Mechanism[D. Kristol, L. Montulli] - http: /www.ietf.org/rfc/rfc2965.txt,http: /www.ietf.org/rfc/rfc2109.txt• RFC 2616 – Hypertext Transfer Protocol -HTTP/1.1 - http: /www.ietf.org/rfc/rfc2616.txtTesting for CSRF (OTG-SESS-005)SummaryCSRF is an attack which forces an end user to execute unwantedactions on a web application in which he/she is currently authenticated.With a little help of social engineering (like sending a linkvia email or chat), an attacker may force the users of a web applicationto execute actions of the attacker’s choosing. A successfulCSRF exploit can compromise end user data and operation, whenit targets a normal user. If the targeted end user is the administratoraccount, a CSRF attack can compromise the entire webapplication.CSRF relies on the following:[1] Web browser behavior regarding the handling of session-re-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!