SlideShare a Scribd company logo
HTTP BASICS
WHERE ARE WE GOING?
HTTP Basics
HTTP Request Methods
HTTP Security Response Headers
Sensitive Data In Transit
Intercepting Proxy
Don’t Trust The HTTP Request!
WEB APPLICATION BEHAVIOUR
 HTTP is stateless. Requests and responses between browsers and servers have no shared memory.
Application layer sessions are needed to track state.
 Dynamic Scripting can occur on Server-Side (e.g. RoR, Django, ASP.NET, JSP, Express, etc) or on Client-
Side (Javascript, Flash, Applets).
 A web server or an application server can deliver HTML to be directly rendered by the web browser. Or,
the server might deliver data as JSON or XML to be processed by a Client-Side application in the
browser.
 Requests for data such as images, scripts, and stylesheets are typically retrieved using HTTP GET.
Requests from HTML forms typically submit data using HTTP POST. AJAX requests can additionally
submit HTTP requests of types PUT, PATCH, and DELETE.
WHAT ARE HTTP HEADERS?
HTTP headers are components of the message header of HTTP
Requests and Responses.
HTTP headers are used to define meta-information for an HTTP
transaction.
HTTP headers are colon-separated name-value pairs in clear-text
string format, terminated by a carriage return (r) and line feed
(n) character sequence.
http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
EXAMPLES OF HTTP REQUEST HEADERS
Authorization:
Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept:
text/plain
Content-Type:
application/x-www-form-urlencoded
User-Agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9;
rv:30.0) Gecko/20100101 Firefox/30.0
VALIDATING HTTP REQUEST HEADERS
 Are the headers themselves known to IANA?
 Are the number of headers received appropriate to the application context?
 Do each of the headers come with a pre-determined regular expression or equivalent for
validation?
 What headers are usually seen in context with other headers?
 How do I detect missing headers?
 Some headers occur in context of the application and are not global. For example, is a
cookie scoped to a domain?
 Some headers have time components to them such as expires. Is the header contextually
validated by date checks?
Official standard on HTTP Request Headers
https://www.iana.org/assignments/message-headers/message-headers.xhtml
HTTP REQUEST: GET VS POST
GET https://example.com/search.jsp?name=foo HTTP/1.0rn
User-Agent: Mozilla/4.0rn
Host: example.comrn
Cookie: SESSIONID=2KDSU72H9GSA289rn
rn
HTTP GET Request
POST https://example.com/search.jsp?data=jim HTTP/1.0rn
User-Agent: Mozilla/4.0rn
Host: example.comrn
Content-Length: 16rn
Cookie: SESSIONID=2KDSU72H9GSA289rn
rn
name=blah&type=1
rn
HTTP POST Request
TRIGGERING AN HTTP(S) GET
 Typing into a URL bar
 Bookmark selection
 <img> tag
 Loading a JS or CSS file
 Loading a Webfont
 HTML Form submission method="GET"
 jQuery.get() http://api.jquery.com/jQuery.get/
HTTP GET REQUEST: PLAINTEXT IMAGE
GET /personal/dancing/naked/inebriated/kauaifun.jpg HTTP/1.1rn
Host: images.manico.netrn
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:30.0)
Gecko/20100101 Firefox/30.0rn
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8rn
Accept-Language: en-US,en;q=0.5rn
Accept-Encoding: gzip, deflatern
DNT: 1rn
Connection: keep-alivern
rn
HTTP GET REQUEST:
INSECURE FORM SUBMISSIONGET
http://example.com/search?form_name=home&title=security&database=cli
ents HTTP/1.1rn
Host: example.comrn
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729)rn
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8rn
Accept-Language: en-us,en;q=0.5rn
Accept-Encoding: gzip,deflatern
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7rn
Keep-Alive: 300rn
Proxy-Connection: keep-alivern
Referer: http://company.com?username=Jim&pass=rp2h6jibalicern
HTTP GET SHOULD BE BORING
 Most web frameworks intentionally do not provide CSRF protection
for GET requests
 A GET request should not produce side effects. It should be
"Nullipotent".
 A GET request should only be used for data retrieval
 A GET request should NEVER be used for:
• Logging out a user
• Logging in a user
• Deleting a resource
• Modifying a resource
• Creating a resource
• Sending an email
HTTP GET PARAMETER LEAKAGE
 Bookmarks
 Browser History
 Proxy Server Logs
 Web Server Logs
 Referrer Request Headers
TRIGGERING AN HTTP/S POST
HTML Form POST Submission
jQuery.post() http://api.jquery.com/jQuery.post/
<form
action="https://acme-bank.example/payment"
method="POST"
id="payment-form">
$.post(
"https://acme-bank.example/payment",
function () {
$(".result").html("Payment was successful");
}
);
HTTP POST REQUEST
POST https://login.example.com:443/login.php?loginfail=3 HTTP/1.1rn
Host: login.example.comrn
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729)rn
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8rn
Accept-Language: en-us,en;q=0.5rn
Accept-Encoding: gzip,deflatern
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7rn
Keep-Alive: 300rn
Connection: keep-alivern
Referer: https://www.example.com/rn
Cookie: JSessionID=1263464364617-95d75464239e7rn
Content-Type: application/x-www-form-urlencodedrn
Content-length: 224rn
rn
locale=en_US&email=joe@example.com&pass=letmein123!!Let
rn
HTTP PUT REQUEST
$.ajax(
"https://contact-manager.example/contacts/1234",
dataType: "json",
type: "PUT",
data: {
name: "John Doe",
email: "john.doe@example.com"
}
);
 An HTTP PUT request is used to replace a resource, or to create a new resource
where the identifier of the resource is known.
 The same security precautions that apply to an HTTP POST request should also
apply to a PUT request.
 Never send sensitive data in the query string of an HTTP PUT request
HTTP PATCH REQUEST
$.ajax(
"https://contact-manager.example/contacts/1234",
dataType: "json",
type: "PATCH",
data: {
email: "john.doe@example.com"
}
);
 An HTTP PATCH request is used to apply partial modifications to a
resource.
 The same security precautions that apply to an HTTP POST request should
also apply to a HTTP PATCH request.
 Never send sensitive data in the query string of an HTTP PATCH request
HTTP DELETE REQUEST
$.ajax(
"https://contact-manager.example/contacts/1234",
dataType: "json",
type: "DELETE"
);
 An HTTP DELETE request is used to delete a resource.
 The same security precautions that apply to an HTTP POST request should
also apply to a PUT request.
 Never send sensitive data in the query string of an HTTP PUT request.
 Not all web servers and application frameworks will allow for a message
body in an HTTP DELETE. Therefore, it is sometimes possible that
sensitive cannot be securely sent from an HTTP DELETE.
TRANSPORTING SENSITIVE DATA
 Never transmit sensitive data over HTTP/S GET
 Always use SSL for everything!
 In HTML forms, only submit sensitive data over HTTPS POST
 When using AJAX, submit sensitive data only using POST, PUT, and PATCH
 Only submit sensitive data only in the HTTPS REQUEST BODY
 Never submit sensitive data in the HTTP/S query string
EXAMPLE HTTP RESPONSE
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Cache-Control: no-cache, no-store, must-revalidate
Expires: -1
Content-Type: text/html; charset=UTF-8
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>WOOT HTML5</title>
</head>
<body>
<h1>I LOVE HTML</h1>
</body>
</html>
HTTP RESPONSE Set-Cookie HEADER
Set-Cookie: NAME=VALUE; expires=EXPIRES;
path=PATH; domain=DOMAIN;
secure; httponly;
Name The name of the cookie parameter
Value The parameter value
Expires The date at which to discard the cookie. If absent, the cookie will not be persistent, and will be discarded
when the browser is closed. If "-1", the cookie will be discarded immediately.
Domain The domain that the cookie applies to
Path The path that the cookie applies to
Secure Indicates that the cookie can only be used over secure HTTPS. USE THIS!
HttpOnly Indicates that the cookie can only be modified and accessed from the server. For example, JavaScript within
the browser application will not be able to access the cookie. USE THIS FOR SESSION IDs!
WHAT ARE HTTP RESPONSE HEADERS?
 HTTP headers are components of the message header of HTTP Responses.
 HTTP headers define different aspects of an HTTP transaction.
 HTTP headers are colon-separated name-value pairs in clear-text string
format, terminated by a carriage return (r) and line feed (n) character
sequence.
http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
HTTP RESPONSE SECURITY
HEADERS SUMMARY
X-Frame-Options
X-Xss-Protection
X-Content-Type-Options
Content Security Policy
Access-Control-Allow-Origin
HTTPS Strict Transport Security
Cache-Control / Pragma
HTTP RESPONSE SECURITY HEADERS
X-Frame-Options  Set to "SAMEORIGIN" to allow framing on same domain.
 Set to "DENY" to deny framing at all
 Set to "ALLOWALL" if you want to allow framing for all website
X-XSS-Protection  Set to "1; mode=block" to use XSS Auditor and block page if XSS attack is detected.
 Set to "0;" if you want to switch XSS Auditor off. This is useful if response contents scripts
from request parameters
X-Content-Security-Policy  A powerful mechanism for controlling which sites certain content types can be loaded
from
Access-Control-Allow-Origin  Used to control which sites are allowed to bypass same origin policies and send cross-
origin requests.
Strict-Transport-Security  Used to control if the browser is allowed to only access a site over a secure connection
Cache-Control  Used to control mandatory content caching rules
HTTP RESPONSE HEADER:
X-Frame-Options
Protects you from most classes of
Clickjacking
X-Frame-Options: DENY
X-Frame-Options: SAMEORIGIN
X-Frame-Options: ALLOW FROM
example.com
HTTP RESPONSE HEADER:
X-Xss-Protection
X-Xss-Protection: 0;
Use the browser’s built-in XSS auditor:
X-Xss-Protection: 1; mode=block
Disable the browser’s built-in XSS auditor:
CONTENT SECURITY POLICY
 Move all inline script and style into separate files
 Add the X-Content-Security-Policy response header to
instruct the browser that CSP is in use
 Define a policy for the site regarding loading of content
Anti-XSS W3C standard
http://www.w3.org/TR/CSP/
CSP Support Statistics
http://caniuse.com/#feat=contentsecuritypolicy
CSP Example Usage
http://content-security-policy.com/
OTHER SSL FAILS
Posting passwords or other sensitive data over HTTP
Using weak version of SSL
Using weak ciphers
Terminating SSL early in your infrastructure
Trusting the CA system 
HTTP RESPONSE HEADER:
Strict-Transport-Security
Forces your browser to always use HTTPS
Strict-transport-security: max-age=10000000; includeSubdomains
Base case:
Strict-transport-security: max-age=10000000
Do all of your subdomains support SSL?
DISABLING THE BROWSER CACHE
Add the following as part of your HTTP Response:
Cache-Control: no-store, no-cache, must-revalidate
Expires: -1
APPLY ALL THE HEADERS!
strict-transport-security: max-age=631138519rn
version: HTTP/1.1rn
x-frame-options: SAMEORIGINrn
x-gitsha: d814fdf74482e7b82c1d9f0344a59dd1d6a700a6rn
x-rack-cache: missrn
x-request-id: 746d48ca76dc0766ac24e74fa905be11rn
x-runtime: 0.023473rn
x-ua-compatible: IE=Edge,chrome=1rn
x-webkit-csp-report-only: default-src 'none'; script-src 'self'; connect-src 'self'; img-src
'self'; style-src 'self’rn
content-security-policy-report-only: default-src 'none'; script-src 'self'; connect-src
'self'; img-src 'self'; style-src 'self’rn
x-content-security-policy-report-only: default-src 'none'; script-src 'self'; connect-src
'self'; img-src 'self'; style-src 'self’rn
ASVS 2 HTTP REQUIREMENTS:
EASY
V11.2 Verify that the application accepts only a defined set of HTTP request methods, such as
GET and POST and unused methods are explicitly blocked.
V11.3 Verify that every HTTP response contains a content type header specifying a safe character
set (e.g., UTF-8).
V11.8 Verify that HTTP headers and / or other mechanisms for older browsers have been
included to protect against clickjacking attacks.
ASVS 2 HTTP REQUIREMENTS:
INTERMEDIATE
V11.6 Verify that HTTP headers in both requests and responses contain only printable ASCII
characters.
V11.9 Verify that HTTP headers added by a frontend (such as X-Real-IP), and used by the
application, cannot be spoofed by the end user.
V11.10 Verify that the HTTP header, X-Frame-Options is in use for sites where content should not
be viewed in a 3rd-party X-Frame. A common middle ground is to send SAMEORIGIN,
meaning only websites of the same origin may frame it.
V11.12 Verify that the HTTP headers do not expose detailed version information of system
components.
HTTP Basics
HTTP Request Methods
HTTP Security Response Headers
Sensitive Data In Transit
Intercepting Proxy
Don’t Trust The HTTP Request!
SUMMARY

More Related Content

What's hot

Restful webservice
Restful webserviceRestful webservice
Restful webservice
Dong Ngoc
 
Rest & RESTful WebServices
Rest & RESTful WebServicesRest & RESTful WebServices
Rest & RESTful WebServices
Prateek Tandon
 
RESTful http_patterns_antipatterns
RESTful http_patterns_antipatternsRESTful http_patterns_antipatterns
RESTful http_patterns_antipatterns
Jan Algermissen
 
Rest web services
Rest web servicesRest web services
Rest web services
Paulo Gandra de Sousa
 
RESTful services
RESTful servicesRESTful services
RESTful services
gouthamrv
 
Representational State Transfer (REST) and HATEOAS
Representational State Transfer (REST) and HATEOASRepresentational State Transfer (REST) and HATEOAS
Representational State Transfer (REST) and HATEOAS
Guy K. Kloss
 
Restful web services ppt
Restful web services pptRestful web services ppt
External Data Access with jQuery
External Data Access with jQueryExternal Data Access with jQuery
External Data Access with jQuery
Doncho Minkov
 
Source Code Analysis with SAST
Source Code Analysis with SASTSource Code Analysis with SAST
Source Code Analysis with SAST
Blueinfy Solutions
 
HTTP protocol and Streams Security
HTTP protocol and Streams SecurityHTTP protocol and Streams Security
HTTP protocol and Streams Security
Blueinfy Solutions
 
ASP.NET WEB API
ASP.NET WEB APIASP.NET WEB API
ASP.NET WEB API
Thang Chung
 
KMUTNB - Internet Programming 2/7
KMUTNB - Internet Programming 2/7KMUTNB - Internet Programming 2/7
KMUTNB - Internet Programming 2/7
phuphax
 
Web Security - Cookies, Domains and CORS
Web Security - Cookies, Domains and CORSWeb Security - Cookies, Domains and CORS
Web Security - Cookies, Domains and CORS
Perfectial, LLC
 
Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0
Dmytro Chyzhykov
 
Implementation advantages of rest
Implementation advantages of restImplementation advantages of rest
Implementation advantages of rest
Balamurugan Easwaran
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding REST
Nitin Pande
 
Soap and restful webservice
Soap and restful webserviceSoap and restful webservice
Soap and restful webservice
Dong Ngoc
 
Cross site calls with javascript - the right way with CORS
Cross site calls with javascript - the right way with CORSCross site calls with javascript - the right way with CORS
Cross site calls with javascript - the right way with CORS
Michael Neale
 
Elegant Rest Design Webinar
Elegant Rest Design WebinarElegant Rest Design Webinar
Elegant Rest Design Webinar
Stormpath
 

What's hot (19)

Restful webservice
Restful webserviceRestful webservice
Restful webservice
 
Rest & RESTful WebServices
Rest & RESTful WebServicesRest & RESTful WebServices
Rest & RESTful WebServices
 
RESTful http_patterns_antipatterns
RESTful http_patterns_antipatternsRESTful http_patterns_antipatterns
RESTful http_patterns_antipatterns
 
Rest web services
Rest web servicesRest web services
Rest web services
 
RESTful services
RESTful servicesRESTful services
RESTful services
 
Representational State Transfer (REST) and HATEOAS
Representational State Transfer (REST) and HATEOASRepresentational State Transfer (REST) and HATEOAS
Representational State Transfer (REST) and HATEOAS
 
Restful web services ppt
Restful web services pptRestful web services ppt
Restful web services ppt
 
External Data Access with jQuery
External Data Access with jQueryExternal Data Access with jQuery
External Data Access with jQuery
 
Source Code Analysis with SAST
Source Code Analysis with SASTSource Code Analysis with SAST
Source Code Analysis with SAST
 
HTTP protocol and Streams Security
HTTP protocol and Streams SecurityHTTP protocol and Streams Security
HTTP protocol and Streams Security
 
ASP.NET WEB API
ASP.NET WEB APIASP.NET WEB API
ASP.NET WEB API
 
KMUTNB - Internet Programming 2/7
KMUTNB - Internet Programming 2/7KMUTNB - Internet Programming 2/7
KMUTNB - Internet Programming 2/7
 
Web Security - Cookies, Domains and CORS
Web Security - Cookies, Domains and CORSWeb Security - Cookies, Domains and CORS
Web Security - Cookies, Domains and CORS
 
Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0
 
Implementation advantages of rest
Implementation advantages of restImplementation advantages of rest
Implementation advantages of rest
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding REST
 
Soap and restful webservice
Soap and restful webserviceSoap and restful webservice
Soap and restful webservice
 
Cross site calls with javascript - the right way with CORS
Cross site calls with javascript - the right way with CORSCross site calls with javascript - the right way with CORS
Cross site calls with javascript - the right way with CORS
 
Elegant Rest Design Webinar
Elegant Rest Design WebinarElegant Rest Design Webinar
Elegant Rest Design Webinar
 

Viewers also liked

JavaDayIV - Leoncini Writing Restful Applications With Resteasy
JavaDayIV - Leoncini Writing Restful Applications With ResteasyJavaDayIV - Leoncini Writing Restful Applications With Resteasy
JavaDayIV - Leoncini Writing Restful Applications With Resteasy
JBug Italy
 
Introduction to API Design: REST and Java
Introduction to API Design: REST and JavaIntroduction to API Design: REST and Java
Introduction to API Design: REST and Java
Philip Johnson
 
RESTful Web Services with Jersey
RESTful Web Services with JerseyRESTful Web Services with Jersey
RESTful Web Services with Jersey
Scott Leberknight
 
Tech Meetup: How to build a Rest API in Java
Tech Meetup: How to build a Rest API in JavaTech Meetup: How to build a Rest API in Java
Tech Meetup: How to build a Rest API in Java
Santex Group
 
Servicio y Consumo de Servicios REST en PHP
Servicio y Consumo de Servicios REST en PHPServicio y Consumo de Servicios REST en PHP
Servicio y Consumo de Servicios REST en PHP
David J. Brenes
 
Infinispan and Enterprise Data Grid
Infinispan and Enterprise Data GridInfinispan and Enterprise Data Grid
Infinispan and Enterprise Data Grid
JBug Italy
 
Rest api design by george reese
Rest api design by george reeseRest api design by george reese
Rest api design by george reese
buildacloud
 
Building RESTful Java Applications with EMF
Building RESTful Java Applications with EMFBuilding RESTful Java Applications with EMF
Building RESTful Java Applications with EMF
Kenn Hussey
 

Viewers also liked (8)

JavaDayIV - Leoncini Writing Restful Applications With Resteasy
JavaDayIV - Leoncini Writing Restful Applications With ResteasyJavaDayIV - Leoncini Writing Restful Applications With Resteasy
JavaDayIV - Leoncini Writing Restful Applications With Resteasy
 
Introduction to API Design: REST and Java
Introduction to API Design: REST and JavaIntroduction to API Design: REST and Java
Introduction to API Design: REST and Java
 
RESTful Web Services with Jersey
RESTful Web Services with JerseyRESTful Web Services with Jersey
RESTful Web Services with Jersey
 
Tech Meetup: How to build a Rest API in Java
Tech Meetup: How to build a Rest API in JavaTech Meetup: How to build a Rest API in Java
Tech Meetup: How to build a Rest API in Java
 
Servicio y Consumo de Servicios REST en PHP
Servicio y Consumo de Servicios REST en PHPServicio y Consumo de Servicios REST en PHP
Servicio y Consumo de Servicios REST en PHP
 
Infinispan and Enterprise Data Grid
Infinispan and Enterprise Data GridInfinispan and Enterprise Data Grid
Infinispan and Enterprise Data Grid
 
Rest api design by george reese
Rest api design by george reeseRest api design by george reese
Rest api design by george reese
 
Building RESTful Java Applications with EMF
Building RESTful Java Applications with EMFBuilding RESTful Java Applications with EMF
Building RESTful Java Applications with EMF
 

Similar to 01. http basics v27

RIA and Ajax
RIA and AjaxRIA and Ajax
RIA and Ajax
Schubert Gomes
 
Web Scraping with PHP
Web Scraping with PHPWeb Scraping with PHP
Web Scraping with PHP
Matthew Turland
 
W-JAX Performance Workshop - Web and AJAX
W-JAX Performance Workshop - Web and AJAXW-JAX Performance Workshop - Web and AJAX
W-JAX Performance Workshop - Web and AJAX
Alois Reitbauer
 
Introduction to Web Architecture
Introduction to Web ArchitectureIntroduction to Web Architecture
Introduction to Web Architecture
Chamnap Chhorn
 
HTTP Basics Demo
HTTP Basics DemoHTTP Basics Demo
HTTP Basics Demo
InMobi Technology
 
Demystifying REST
Demystifying RESTDemystifying REST
Demystifying REST
Kirsten Hunter
 
Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applications
Satish b
 
WWW and HTTP
WWW and HTTPWWW and HTTP
WWW and HTTP
BG Java EE Course
 
REST
RESTREST
Under the Covers with the Web
Under the Covers with the WebUnder the Covers with the Web
Under the Covers with the Web
Trevor Lohrbeer
 
Browser Security
Browser SecurityBrowser Security
Browser Security
Roberto Suggi Liverani
 
jkljklj
jkljkljjkljklj
jkljklj
hoefo
 
Spider Course Day 1
Spider Course Day 1Spider Course Day 1
Spider Course Day 1
Harishankaran K
 
ASP.NET WEB API Training
ASP.NET WEB API TrainingASP.NET WEB API Training
ASP.NET WEB API Training
Chalermpon Areepong
 
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...
ruyalarcon
 
Scalable Reliable Secure REST
Scalable Reliable Secure RESTScalable Reliable Secure REST
Scalable Reliable Secure REST
guestb2ed5f
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...
WebStackAcademy
 
Ellerslie User Group - ReST Presentation
Ellerslie User Group - ReST PresentationEllerslie User Group - ReST Presentation
Ellerslie User Group - ReST Presentation
Alex Henderson
 
Browser security
Browser securityBrowser security
Browser security
Uday Anand
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web Services
Bradley Holt
 

Similar to 01. http basics v27 (20)

RIA and Ajax
RIA and AjaxRIA and Ajax
RIA and Ajax
 
Web Scraping with PHP
Web Scraping with PHPWeb Scraping with PHP
Web Scraping with PHP
 
W-JAX Performance Workshop - Web and AJAX
W-JAX Performance Workshop - Web and AJAXW-JAX Performance Workshop - Web and AJAX
W-JAX Performance Workshop - Web and AJAX
 
Introduction to Web Architecture
Introduction to Web ArchitectureIntroduction to Web Architecture
Introduction to Web Architecture
 
HTTP Basics Demo
HTTP Basics DemoHTTP Basics Demo
HTTP Basics Demo
 
Demystifying REST
Demystifying RESTDemystifying REST
Demystifying REST
 
Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applications
 
WWW and HTTP
WWW and HTTPWWW and HTTP
WWW and HTTP
 
REST
RESTREST
REST
 
Under the Covers with the Web
Under the Covers with the WebUnder the Covers with the Web
Under the Covers with the Web
 
Browser Security
Browser SecurityBrowser Security
Browser Security
 
jkljklj
jkljkljjkljklj
jkljklj
 
Spider Course Day 1
Spider Course Day 1Spider Course Day 1
Spider Course Day 1
 
ASP.NET WEB API Training
ASP.NET WEB API TrainingASP.NET WEB API Training
ASP.NET WEB API Training
 
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...
 
Scalable Reliable Secure REST
Scalable Reliable Secure RESTScalable Reliable Secure REST
Scalable Reliable Secure REST
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...
 
Ellerslie User Group - ReST Presentation
Ellerslie User Group - ReST PresentationEllerslie User Group - ReST Presentation
Ellerslie User Group - ReST Presentation
 
Browser security
Browser securityBrowser security
Browser security
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web Services
 

More from Eoin Keary

IISF-March2023.pptx
IISF-March2023.pptxIISF-March2023.pptx
IISF-March2023.pptx
Eoin Keary
 
Validation of vulnerabilities.pdf
Validation of vulnerabilities.pdfValidation of vulnerabilities.pdf
Validation of vulnerabilities.pdf
Eoin Keary
 
Does a Hybrid model for vulnerability Management Make Sense.pdf
Does a Hybrid model for vulnerability Management Make Sense.pdfDoes a Hybrid model for vulnerability Management Make Sense.pdf
Does a Hybrid model for vulnerability Management Make Sense.pdf
Eoin Keary
 
Edgescan 2022 Vulnerability Statistics Report
Edgescan 2022 Vulnerability Statistics ReportEdgescan 2022 Vulnerability Statistics Report
Edgescan 2022 Vulnerability Statistics Report
Eoin Keary
 
Edgescan 2021 Vulnerability Stats Report
Edgescan 2021 Vulnerability Stats ReportEdgescan 2021 Vulnerability Stats Report
Edgescan 2021 Vulnerability Stats Report
Eoin Keary
 
One login enemy at the gates
One login enemy at the gatesOne login enemy at the gates
One login enemy at the gates
Eoin Keary
 
Edgescan vulnerability stats report 2020
Edgescan vulnerability stats report 2020Edgescan vulnerability stats report 2020
Edgescan vulnerability stats report 2020
Eoin Keary
 
edgescan vulnerability stats report (2018)
 edgescan vulnerability stats report (2018)  edgescan vulnerability stats report (2018)
edgescan vulnerability stats report (2018)
Eoin Keary
 
edgescan vulnerability stats report (2019)
edgescan vulnerability stats report (2019) edgescan vulnerability stats report (2019)
edgescan vulnerability stats report (2019)
Eoin Keary
 
Full stack vulnerability management at scale
Full stack vulnerability management at scaleFull stack vulnerability management at scale
Full stack vulnerability management at scale
Eoin Keary
 
Vulnerability Intelligence - Standing Still in a world full of change
Vulnerability Intelligence - Standing Still in a world full of changeVulnerability Intelligence - Standing Still in a world full of change
Vulnerability Intelligence - Standing Still in a world full of change
Eoin Keary
 
Edgescan vulnerability stats report 2019 - h-isac-2-2-2019
Edgescan   vulnerability stats report 2019 - h-isac-2-2-2019Edgescan   vulnerability stats report 2019 - h-isac-2-2-2019
Edgescan vulnerability stats report 2019 - h-isac-2-2-2019
Eoin Keary
 
Hide and seek - Attack Surface Management and continuous assessment.
Hide and seek - Attack Surface Management and continuous assessment.Hide and seek - Attack Surface Management and continuous assessment.
Hide and seek - Attack Surface Management and continuous assessment.
Eoin Keary
 
Online Gaming Cyber security and Threat Model
Online Gaming Cyber security and Threat ModelOnline Gaming Cyber security and Threat Model
Online Gaming Cyber security and Threat Model
Eoin Keary
 
Keeping the wolf from 1000 doors.
Keeping the wolf from 1000 doors.Keeping the wolf from 1000 doors.
Keeping the wolf from 1000 doors.
Eoin Keary
 
Security by the numbers
Security by the numbersSecurity by the numbers
Security by the numbers
Eoin Keary
 
Web security – everything we know is wrong cloud version
Web security – everything we know is wrong   cloud versionWeb security – everything we know is wrong   cloud version
Web security – everything we know is wrong cloud version
Eoin Keary
 
Cybersecurity by the numbers
Cybersecurity by the numbersCybersecurity by the numbers
Cybersecurity by the numbers
Eoin Keary
 
Ebu class edgescan-2017
Ebu class edgescan-2017Ebu class edgescan-2017
Ebu class edgescan-2017
Eoin Keary
 
Vulnerability management and threat detection by the numbers
Vulnerability management and threat detection by the numbersVulnerability management and threat detection by the numbers
Vulnerability management and threat detection by the numbers
Eoin Keary
 

More from Eoin Keary (20)

IISF-March2023.pptx
IISF-March2023.pptxIISF-March2023.pptx
IISF-March2023.pptx
 
Validation of vulnerabilities.pdf
Validation of vulnerabilities.pdfValidation of vulnerabilities.pdf
Validation of vulnerabilities.pdf
 
Does a Hybrid model for vulnerability Management Make Sense.pdf
Does a Hybrid model for vulnerability Management Make Sense.pdfDoes a Hybrid model for vulnerability Management Make Sense.pdf
Does a Hybrid model for vulnerability Management Make Sense.pdf
 
Edgescan 2022 Vulnerability Statistics Report
Edgescan 2022 Vulnerability Statistics ReportEdgescan 2022 Vulnerability Statistics Report
Edgescan 2022 Vulnerability Statistics Report
 
Edgescan 2021 Vulnerability Stats Report
Edgescan 2021 Vulnerability Stats ReportEdgescan 2021 Vulnerability Stats Report
Edgescan 2021 Vulnerability Stats Report
 
One login enemy at the gates
One login enemy at the gatesOne login enemy at the gates
One login enemy at the gates
 
Edgescan vulnerability stats report 2020
Edgescan vulnerability stats report 2020Edgescan vulnerability stats report 2020
Edgescan vulnerability stats report 2020
 
edgescan vulnerability stats report (2018)
 edgescan vulnerability stats report (2018)  edgescan vulnerability stats report (2018)
edgescan vulnerability stats report (2018)
 
edgescan vulnerability stats report (2019)
edgescan vulnerability stats report (2019) edgescan vulnerability stats report (2019)
edgescan vulnerability stats report (2019)
 
Full stack vulnerability management at scale
Full stack vulnerability management at scaleFull stack vulnerability management at scale
Full stack vulnerability management at scale
 
Vulnerability Intelligence - Standing Still in a world full of change
Vulnerability Intelligence - Standing Still in a world full of changeVulnerability Intelligence - Standing Still in a world full of change
Vulnerability Intelligence - Standing Still in a world full of change
 
Edgescan vulnerability stats report 2019 - h-isac-2-2-2019
Edgescan   vulnerability stats report 2019 - h-isac-2-2-2019Edgescan   vulnerability stats report 2019 - h-isac-2-2-2019
Edgescan vulnerability stats report 2019 - h-isac-2-2-2019
 
Hide and seek - Attack Surface Management and continuous assessment.
Hide and seek - Attack Surface Management and continuous assessment.Hide and seek - Attack Surface Management and continuous assessment.
Hide and seek - Attack Surface Management and continuous assessment.
 
Online Gaming Cyber security and Threat Model
Online Gaming Cyber security and Threat ModelOnline Gaming Cyber security and Threat Model
Online Gaming Cyber security and Threat Model
 
Keeping the wolf from 1000 doors.
Keeping the wolf from 1000 doors.Keeping the wolf from 1000 doors.
Keeping the wolf from 1000 doors.
 
Security by the numbers
Security by the numbersSecurity by the numbers
Security by the numbers
 
Web security – everything we know is wrong cloud version
Web security – everything we know is wrong   cloud versionWeb security – everything we know is wrong   cloud version
Web security – everything we know is wrong cloud version
 
Cybersecurity by the numbers
Cybersecurity by the numbersCybersecurity by the numbers
Cybersecurity by the numbers
 
Ebu class edgescan-2017
Ebu class edgescan-2017Ebu class edgescan-2017
Ebu class edgescan-2017
 
Vulnerability management and threat detection by the numbers
Vulnerability management and threat detection by the numbersVulnerability management and threat detection by the numbers
Vulnerability management and threat detection by the numbers
 

Recently uploaded

Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
davidjhones387
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
xjq03c34
 
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
thezot
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
3a0sd7z3
 
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
APNIC
 
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
k4ncd0z
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
Paul Walk
 
Integrating Physical and Cybersecurity to Lower Risks in Healthcare!
Integrating Physical and Cybersecurity to Lower Risks in Healthcare!Integrating Physical and Cybersecurity to Lower Risks in Healthcare!
Integrating Physical and Cybersecurity to Lower Risks in Healthcare!
Alec Kassir cozmozone
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
rtunex8r
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
Tarandeep Singh
 
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
APNIC
 
How to make a complaint to the police for Social Media Fraud.pdf
How to make a complaint to the police for Social Media Fraud.pdfHow to make a complaint to the police for Social Media Fraud.pdf
How to make a complaint to the police for Social Media Fraud.pdf
Infosec train
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
3a0sd7z3
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
Donato Onofri
 

Recently uploaded (14)

Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
 
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
 
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
 
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
 
Integrating Physical and Cybersecurity to Lower Risks in Healthcare!
Integrating Physical and Cybersecurity to Lower Risks in Healthcare!Integrating Physical and Cybersecurity to Lower Risks in Healthcare!
Integrating Physical and Cybersecurity to Lower Risks in Healthcare!
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
 
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
 
How to make a complaint to the police for Social Media Fraud.pdf
How to make a complaint to the police for Social Media Fraud.pdfHow to make a complaint to the police for Social Media Fraud.pdf
How to make a complaint to the police for Social Media Fraud.pdf
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
 

01. http basics v27

  • 2. WHERE ARE WE GOING? HTTP Basics HTTP Request Methods HTTP Security Response Headers Sensitive Data In Transit Intercepting Proxy Don’t Trust The HTTP Request!
  • 3. WEB APPLICATION BEHAVIOUR  HTTP is stateless. Requests and responses between browsers and servers have no shared memory. Application layer sessions are needed to track state.  Dynamic Scripting can occur on Server-Side (e.g. RoR, Django, ASP.NET, JSP, Express, etc) or on Client- Side (Javascript, Flash, Applets).  A web server or an application server can deliver HTML to be directly rendered by the web browser. Or, the server might deliver data as JSON or XML to be processed by a Client-Side application in the browser.  Requests for data such as images, scripts, and stylesheets are typically retrieved using HTTP GET. Requests from HTML forms typically submit data using HTTP POST. AJAX requests can additionally submit HTTP requests of types PUT, PATCH, and DELETE.
  • 4. WHAT ARE HTTP HEADERS? HTTP headers are components of the message header of HTTP Requests and Responses. HTTP headers are used to define meta-information for an HTTP transaction. HTTP headers are colon-separated name-value pairs in clear-text string format, terminated by a carriage return (r) and line feed (n) character sequence. http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
  • 5. EXAMPLES OF HTTP REQUEST HEADERS Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: text/plain Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:30.0) Gecko/20100101 Firefox/30.0
  • 6. VALIDATING HTTP REQUEST HEADERS  Are the headers themselves known to IANA?  Are the number of headers received appropriate to the application context?  Do each of the headers come with a pre-determined regular expression or equivalent for validation?  What headers are usually seen in context with other headers?  How do I detect missing headers?  Some headers occur in context of the application and are not global. For example, is a cookie scoped to a domain?  Some headers have time components to them such as expires. Is the header contextually validated by date checks? Official standard on HTTP Request Headers https://www.iana.org/assignments/message-headers/message-headers.xhtml
  • 7. HTTP REQUEST: GET VS POST GET https://example.com/search.jsp?name=foo HTTP/1.0rn User-Agent: Mozilla/4.0rn Host: example.comrn Cookie: SESSIONID=2KDSU72H9GSA289rn rn HTTP GET Request POST https://example.com/search.jsp?data=jim HTTP/1.0rn User-Agent: Mozilla/4.0rn Host: example.comrn Content-Length: 16rn Cookie: SESSIONID=2KDSU72H9GSA289rn rn name=blah&type=1 rn HTTP POST Request
  • 8. TRIGGERING AN HTTP(S) GET  Typing into a URL bar  Bookmark selection  <img> tag  Loading a JS or CSS file  Loading a Webfont  HTML Form submission method="GET"  jQuery.get() http://api.jquery.com/jQuery.get/
  • 9. HTTP GET REQUEST: PLAINTEXT IMAGE GET /personal/dancing/naked/inebriated/kauaifun.jpg HTTP/1.1rn Host: images.manico.netrn User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:30.0) Gecko/20100101 Firefox/30.0rn Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8rn Accept-Language: en-US,en;q=0.5rn Accept-Encoding: gzip, deflatern DNT: 1rn Connection: keep-alivern rn
  • 10. HTTP GET REQUEST: INSECURE FORM SUBMISSIONGET http://example.com/search?form_name=home&title=security&database=cli ents HTTP/1.1rn Host: example.comrn User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729)rn Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8rn Accept-Language: en-us,en;q=0.5rn Accept-Encoding: gzip,deflatern Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7rn Keep-Alive: 300rn Proxy-Connection: keep-alivern Referer: http://company.com?username=Jim&pass=rp2h6jibalicern
  • 11. HTTP GET SHOULD BE BORING  Most web frameworks intentionally do not provide CSRF protection for GET requests  A GET request should not produce side effects. It should be "Nullipotent".  A GET request should only be used for data retrieval  A GET request should NEVER be used for: • Logging out a user • Logging in a user • Deleting a resource • Modifying a resource • Creating a resource • Sending an email
  • 12. HTTP GET PARAMETER LEAKAGE  Bookmarks  Browser History  Proxy Server Logs  Web Server Logs  Referrer Request Headers
  • 13. TRIGGERING AN HTTP/S POST HTML Form POST Submission jQuery.post() http://api.jquery.com/jQuery.post/ <form action="https://acme-bank.example/payment" method="POST" id="payment-form"> $.post( "https://acme-bank.example/payment", function () { $(".result").html("Payment was successful"); } );
  • 14. HTTP POST REQUEST POST https://login.example.com:443/login.php?loginfail=3 HTTP/1.1rn Host: login.example.comrn User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729)rn Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8rn Accept-Language: en-us,en;q=0.5rn Accept-Encoding: gzip,deflatern Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7rn Keep-Alive: 300rn Connection: keep-alivern Referer: https://www.example.com/rn Cookie: JSessionID=1263464364617-95d75464239e7rn Content-Type: application/x-www-form-urlencodedrn Content-length: 224rn rn locale=en_US&email=joe@example.com&pass=letmein123!!Let rn
  • 15. HTTP PUT REQUEST $.ajax( "https://contact-manager.example/contacts/1234", dataType: "json", type: "PUT", data: { name: "John Doe", email: "john.doe@example.com" } );  An HTTP PUT request is used to replace a resource, or to create a new resource where the identifier of the resource is known.  The same security precautions that apply to an HTTP POST request should also apply to a PUT request.  Never send sensitive data in the query string of an HTTP PUT request
  • 16. HTTP PATCH REQUEST $.ajax( "https://contact-manager.example/contacts/1234", dataType: "json", type: "PATCH", data: { email: "john.doe@example.com" } );  An HTTP PATCH request is used to apply partial modifications to a resource.  The same security precautions that apply to an HTTP POST request should also apply to a HTTP PATCH request.  Never send sensitive data in the query string of an HTTP PATCH request
  • 17. HTTP DELETE REQUEST $.ajax( "https://contact-manager.example/contacts/1234", dataType: "json", type: "DELETE" );  An HTTP DELETE request is used to delete a resource.  The same security precautions that apply to an HTTP POST request should also apply to a PUT request.  Never send sensitive data in the query string of an HTTP PUT request.  Not all web servers and application frameworks will allow for a message body in an HTTP DELETE. Therefore, it is sometimes possible that sensitive cannot be securely sent from an HTTP DELETE.
  • 18. TRANSPORTING SENSITIVE DATA  Never transmit sensitive data over HTTP/S GET  Always use SSL for everything!  In HTML forms, only submit sensitive data over HTTPS POST  When using AJAX, submit sensitive data only using POST, PUT, and PATCH  Only submit sensitive data only in the HTTPS REQUEST BODY  Never submit sensitive data in the HTTP/S query string
  • 19. EXAMPLE HTTP RESPONSE HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Cache-Control: no-cache, no-store, must-revalidate Expires: -1 Content-Type: text/html; charset=UTF-8 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>WOOT HTML5</title> </head> <body> <h1>I LOVE HTML</h1> </body> </html>
  • 20. HTTP RESPONSE Set-Cookie HEADER Set-Cookie: NAME=VALUE; expires=EXPIRES; path=PATH; domain=DOMAIN; secure; httponly; Name The name of the cookie parameter Value The parameter value Expires The date at which to discard the cookie. If absent, the cookie will not be persistent, and will be discarded when the browser is closed. If "-1", the cookie will be discarded immediately. Domain The domain that the cookie applies to Path The path that the cookie applies to Secure Indicates that the cookie can only be used over secure HTTPS. USE THIS! HttpOnly Indicates that the cookie can only be modified and accessed from the server. For example, JavaScript within the browser application will not be able to access the cookie. USE THIS FOR SESSION IDs!
  • 21. WHAT ARE HTTP RESPONSE HEADERS?  HTTP headers are components of the message header of HTTP Responses.  HTTP headers define different aspects of an HTTP transaction.  HTTP headers are colon-separated name-value pairs in clear-text string format, terminated by a carriage return (r) and line feed (n) character sequence. http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
  • 22. HTTP RESPONSE SECURITY HEADERS SUMMARY X-Frame-Options X-Xss-Protection X-Content-Type-Options Content Security Policy Access-Control-Allow-Origin HTTPS Strict Transport Security Cache-Control / Pragma
  • 23. HTTP RESPONSE SECURITY HEADERS X-Frame-Options  Set to "SAMEORIGIN" to allow framing on same domain.  Set to "DENY" to deny framing at all  Set to "ALLOWALL" if you want to allow framing for all website X-XSS-Protection  Set to "1; mode=block" to use XSS Auditor and block page if XSS attack is detected.  Set to "0;" if you want to switch XSS Auditor off. This is useful if response contents scripts from request parameters X-Content-Security-Policy  A powerful mechanism for controlling which sites certain content types can be loaded from Access-Control-Allow-Origin  Used to control which sites are allowed to bypass same origin policies and send cross- origin requests. Strict-Transport-Security  Used to control if the browser is allowed to only access a site over a secure connection Cache-Control  Used to control mandatory content caching rules
  • 24. HTTP RESPONSE HEADER: X-Frame-Options Protects you from most classes of Clickjacking X-Frame-Options: DENY X-Frame-Options: SAMEORIGIN X-Frame-Options: ALLOW FROM example.com
  • 25. HTTP RESPONSE HEADER: X-Xss-Protection X-Xss-Protection: 0; Use the browser’s built-in XSS auditor: X-Xss-Protection: 1; mode=block Disable the browser’s built-in XSS auditor:
  • 26. CONTENT SECURITY POLICY  Move all inline script and style into separate files  Add the X-Content-Security-Policy response header to instruct the browser that CSP is in use  Define a policy for the site regarding loading of content Anti-XSS W3C standard http://www.w3.org/TR/CSP/ CSP Support Statistics http://caniuse.com/#feat=contentsecuritypolicy CSP Example Usage http://content-security-policy.com/
  • 27. OTHER SSL FAILS Posting passwords or other sensitive data over HTTP Using weak version of SSL Using weak ciphers Terminating SSL early in your infrastructure Trusting the CA system 
  • 28. HTTP RESPONSE HEADER: Strict-Transport-Security Forces your browser to always use HTTPS Strict-transport-security: max-age=10000000; includeSubdomains Base case: Strict-transport-security: max-age=10000000 Do all of your subdomains support SSL?
  • 29. DISABLING THE BROWSER CACHE Add the following as part of your HTTP Response: Cache-Control: no-store, no-cache, must-revalidate Expires: -1
  • 30. APPLY ALL THE HEADERS! strict-transport-security: max-age=631138519rn version: HTTP/1.1rn x-frame-options: SAMEORIGINrn x-gitsha: d814fdf74482e7b82c1d9f0344a59dd1d6a700a6rn x-rack-cache: missrn x-request-id: 746d48ca76dc0766ac24e74fa905be11rn x-runtime: 0.023473rn x-ua-compatible: IE=Edge,chrome=1rn x-webkit-csp-report-only: default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self'; style-src 'self’rn content-security-policy-report-only: default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self'; style-src 'self’rn x-content-security-policy-report-only: default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self'; style-src 'self’rn
  • 31. ASVS 2 HTTP REQUIREMENTS: EASY V11.2 Verify that the application accepts only a defined set of HTTP request methods, such as GET and POST and unused methods are explicitly blocked. V11.3 Verify that every HTTP response contains a content type header specifying a safe character set (e.g., UTF-8). V11.8 Verify that HTTP headers and / or other mechanisms for older browsers have been included to protect against clickjacking attacks.
  • 32. ASVS 2 HTTP REQUIREMENTS: INTERMEDIATE V11.6 Verify that HTTP headers in both requests and responses contain only printable ASCII characters. V11.9 Verify that HTTP headers added by a frontend (such as X-Real-IP), and used by the application, cannot be spoofed by the end user. V11.10 Verify that the HTTP header, X-Frame-Options is in use for sites where content should not be viewed in a 3rd-party X-Frame. A common middle ground is to send SAMEORIGIN, meaning only websites of the same origin may frame it. V11.12 Verify that the HTTP headers do not expose detailed version information of system components.
  • 33. HTTP Basics HTTP Request Methods HTTP Security Response Headers Sensitive Data In Transit Intercepting Proxy Don’t Trust The HTTP Request! SUMMARY

Editor's Notes

  1. 1
  2. The stateless nature of HTTP means that abstractions need to be used in order to create a persistence layer between the client and server. This creates complexities which are responsible for many web security issues. Websockets was primarily designed to provide full-duplex communication between web browser and server. The initiation of the websockets session is handled through via HTTP, but it otherwise acts independently of HTTP. However, because it allows for communication to the browser, it opens up possible attack vectors. Although traditional web forms primarily use GET and POST, many contemporary SPAs make extensive use of PUT/PATCH/DELETE. An SPA is a "Single Page Application". Examples of frameworks used to build SPAs would be BackboneJS, Angular, and EmberJS.
  3. Http headers can be thought of the addressing information on the outside of a postage envelope.
  4. The Authorization header is built-in method for the browser to send identification credentials for a user to the web server. This header should only be used over HTTPS. The Accept header allows the browser to identify to the server which kinds of content it is expecting in the HTTP response. The Content-Type header tells the browser what kind of content is being sent in the request. The User-Agent identifies information about the browser to the web server.
  5. Not all headers will be known to IANA. Some applications might need to make use of custom request headers. In this case, the application should check the custom request headers against a whitelist within the application.
  6. For your safety, you are advised to not download kauaifun.jpg
  7. Some of the security problems here are: The GET URL contains sensitive parameters. These can turn up in log files and analytics tools. The Referer URL contains sensitive parameters. These can turn up in log files and analytics tools. The JSESSIONID is being sent over an insecure (non HTTPS) connection. This could allow for a session-hijacking attack.
  8. RFC 2616 #9.1.1: "the GET and HEAD methods SHOULD NOT have the significance of taking an action other than retrieval" Nullipotent means "No Power". https://en.wiktionary.org/wiki/nullipotent: Describes "nullipotent" as "an action which has no side effect. Queries are typically nullipotent: they return useful data, but do not change the data structure queried."
  9. Bookmarks: Bookmarks are not stored securely, leaving URLs open to a potential attacker. Browser History: Browser history is not stored securely, leaving URLs open to a potential attacker. Proxy Server Logs: Proxies can potentially be operated by persons with malicious intentions. Even trustworthy proxies are susceptible to intrusions, which could reveal proxy logs to an attacker. Web Server Logs: In the event that a web server is compromised, an attacker could have access to web server logs which could reveal sensitive information in URLs. Referer: The HTTP 1.1 RFC explicitly states: "Clients SHOULD NOT include a Referer header field in a (non-secure) HTTP request if the referring page was transferred with a secure protocol."
  10. rfc2616, section 15.1.3 recommends that sensitive data should not be sent in a form submission which has method="GET". But, it is a good idea to take this a step further, and simply never use method="GET" at all as a general good practice.
  11. RFC 2616 #9.6: "The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI." HTTP PUT is useful when designing RESTful web applications
  12. RFC 5789 #2: "The PATCH method requests that a set of changes described in the request entity be applied to the resource identified by the Request-URI. The set of changes is represented in a format called a "patch document" identified by a media type. If the Request-URI does not point to an existing resource, the server MAY create a new resource, depending on the patch document type." HTTP PATCH is useful when designing RESTful web applications, although opinions on how it should be properly implemented are varied.
  13. RFC 2616 #9.7: "The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human intervention (or other means) on the origin server. The client cannot be guaranteed that the operation has been carried out, even if the status code returned from the origin server indicates that the action has been completed successfully. However, the server SHOULD NOT indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible location." HTTP DELETE is useful when designing RESTful web applications
  14. The body is HTML5 markup: http://www.w3.org/TR/html5/
  15. JM: Save resources since nothing is framed BC: Use "DENY" whenever possible
  16. BC: Surprisingly, it seems difficult to find information on the actual algorithms the XSS protection uses
  17. BC: Talk about when/how to use CSP vs when/how to use CORS? BC: This is a very interesting topic. Perhaps add visual examples to slide?
  18. BC: Heartbleed as example of insecure SSL version
  19. BC: Run site through SSL checker https://www.ssllabs.com/ssltest/
  20. // HTTP 1.1 response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); response.setDateHeader("Expires", -1); // HTTP 1.0 response.setHeader("Pragma","no-cache"); response.setDateHeader("Expires", -1);