1 Introduction
1 Introduction
you will need before you begin your web application security
testing.
1.2 Encoding
1.4 Cookies
1.5 Session
HEADERS\r\n
\r (Carriage Return): moves the cursors to the
\r\n beginning of the line
\n (Line Feed): moves the cursor down to the next line
\r\n: is the same of hitting enter on your keyboard
MESSAGE BODY\r\n
google.com:80
GET / HTTP/1.1
Host: www.google.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
rv:36.0) Gecko/20100101 Firefox/36.0
Accept: text/html,application/xhtml+xml
Accept-Encoding: gzip, deflate
Connection: keep-alive
Penetration Testing Professional 5.0 – Caendra Inc. © 2018
GET / HTTP/1.1
Host: www.google.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
rv:36.0) Gecko/20100101 Firefox/36.0
Accept: text/html,application/xhtml+xml
Accept-Encoding: gzip, deflate
Connection: keep-alive
With HTTP 1.1 you can keep your connection to the remote web
server open for an unspecified amount of time using the value
"keep-alive". This indicates that all requests to the web server
will continue to be sent through this connection without
initiating a new connection every time (as in HTTP 1.0).
Penetration Testing Professional 5.0 – Caendra Inc. © 2018
Now that we know how the request is composed, let’s inspect the
web server response.
In response to the HTTP Request, the web server will respond with
the requested resource, preceded by a bunch of new Headers.
These new headers from the server will be used by your web
browser to interpret the content contained in the response
content.
Penetration Testing Professional 5.0 – Caendra Inc. © 2018
HTTP/1.1 200 OK
Date: Fri, 13 Mar 2015 11:26:05 GMT
Cache-Control: private, max-age=0
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
Server: gws
Content-Length: 258
<PAGE CONTENT>
<PAGE CONTENT>
<PAGE CONTENT>
<PAGE CONTENT>
• 403 Forbidden, client does not have enough privileges and the server
refuses to fulfill the request.
• 404 Not Found, server cannot find a resource matching the request.
• 500 Internal Server Error, server does not support the functionality
required to fulfill the request.
Penetration Testing Professional 5.0 – Caendra Inc. © 2018
DATE
HTTP/1.1 200 OK
Date: Fri, 13 Mar 2015 11:26:05 GMT
Cache-Control: private, max-age=0
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
Server: gws
Content-Length: 258
<PAGE CONTENT>
Date represents the date and time at which the message was
originated.
<PAGE CONTENT>
The Cache headers allow the Browser and the Server to agree
about caching rules. Cached content save bandwidth, because
in short, they prevent your browser from re-requesting
content that has not changed.
Penetration Testing Professional 5.0 – Caendra Inc. © 2018
CONTENT TYPE
HTTP/1.1 200 OK
Date: Fri, 13 Mar 2015 11:26:05 GMT
Cache-Control: private, max-age=0
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
Server: gws
Content-Length: 258
<PAGE CONTENT>
Content-Type lets the client know how to interpret the body of the
message.
<PAGE CONTENT>
<PAGE CONTENT>
The Server header displays the Web Server banner. Apache and IIS
are common web servers. Google uses a custom webserver
banner: gws (that stands for Google Web Server).
<PAGE CONTENT>
<PAGE CONTENT>
https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
???
GET / SSL/TLS
HTTP/1.1 HTTP
https://unicode-table.com/en/#0032
https://www.w3.org/International/articles/definitions-characters/
HTML5
<meta charset="UTF-8">
https://tools.ietf.org/html/rfc2616
https://www.w3schools.com/tags/ref_urlencode.asp
Here’s an example:
http://www.elsptp.site
http://www.elsptp.site
http://www.elsptp.site
http://www.elsptp.site :80
As you can see without SOP you could not surf the Internet.
Example 1 Example 2
a.elsptp.site b.elsptp.site
index.html home.html
window.location document.domain
Read
Write
<html>
…
<body>
<iframe src="http//www.elearnsecurity.com/index.html">
</iframe>
</body>
</html>
window.frames[0].location=http://www.google.com;
Origin A Origin B
a.elsptp.site b.elsptp.site
<script> <script>
document.domanin="elsptp.site" document.domanin="elsptp.site"
</script> </script>
index.html home.html
Penetration Testing Professional 5.0 – Caendra Inc. © 2018
The new HTML5 feature known as Cross Window Messaging
permits different documents (iframes, popups, and current
window) to communicate with each other regardless of the
same origin policy by using a simple synchronous mechanism.
Unspecified cookie
Specified cookie domain
domain
Internet Explorer
exception
POST /login.php
Host: www.google.com
usr=John&Pass=mypass
GET /mail.php
Host: www.google.com
Cookie=authenticated="1";
POST (http://a.elsptp.site/login.php)
The cookie is
accepted and will HTTP RESPONSE HEADER:
be available only …
Set-Cookie: SESSID=d8a4z21
to the target Path =/
domain
a.elsptp.site,
since the domain GET (http://a.elsptp.site/logout.php)
value was not HTTP Request Header:
specified. …
Cookie SESSID:=d8a4z21
• http://elsptp.site/* • http://*.elsptp.site/*
• https://elsptp.site/* • https://*.elsptp.site/*
Penetration Testing Professional 5.0 – Caendra Inc. © 2018
This is what will happen. The cookie previously set is sent to
both a and b subdomains. a.elsptp.site
GET (http://a.elsptp.site/page1.php)
Web Browser HTTP Request Header:
…
Cookie SESSID:=d8a4z21
b.elsptp.site
GET (http://b.elsptp.site/index.php)
HTTP Request Header:
…
Cookie SESSID:=d8a4z21
learning/lab.php
GET (http://a.elsptp.site/learning/lab.php)
HTTP Request Header:
…
Cookie SESSID:=d8a4z21
elsptp.site
GET (http://elsptp.site/lab.php)
HTTP Request Header: lab.php
…
Cookie SESSID:=B
POST (http://a.elsptp.site/login.php)
Var1=abc
Var2=123
SessionID=02ab12
• SESSION=0wvCtOBWDH8w
• PHPSESSID=l3Kn5Z6Uo4pH
• JSESSIONID=W7DPUBgh7kTM
http://example.site/resource.php?sessid=k27rds7h8w
https://portswigger.net/burp/
https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project
Penetration Testing Professional 5.0 – Caendra Inc. © 2018
Do not confuse intercepting proxies with common web proxy
servers like Squid.
https://portswigger.net/burp
Penetration Testing Professional 5.0 – Caendra Inc. © 2018
Burp suite will let you:
• Intercept requests and responses between your browser
and the web server.
• Build requests manually.
• Crawl a website, by automatically visiting every page in a
website.
• Fuzz web applications, by sending patterns of valid and
invalid inputs to test their behavior.
SSL/TLS Strong Encryption: An Introduction HTTP Overview, History, Versions and Standards
http://httpd.apache.org/docs/2.2/ssl/ssl_intr http://www.tcpipguide.com/free/t_HTTPOve
o.html rviewHistoryVersionsandStandards.htm
ZAP
https://www.owasp.org/index.php/OWASP_Z
ed_Attack_Proxy_Project