CCIT25 - WS_1.1
CCIT25 - WS_1.1
While working at CERN, Tim Tim Berners-Lee posted on HTTPS was formally specified by
Berners-Lee wrote a proposal to alt.hypertext newsgroup. This is RFC 2818, TLS replaced SSL.
build a hypertext system over the considered to be the official start
internet. of the WWW as a public project.
Renamed the World Wide Web In 1991 the first documented Due to the widespread adoption
during its implementation in version was HTTP/0.9, which of the World Wide Web many
1990. Built over the existing TCP supported only GET method. RFC things have changed. Today the
and IP protocols, it consisted of 4 1945 was published in May 1996 latest version is HTTP/3, UDP is
building blocks: HTML, HTTP, a and was the final HTTP/1.0 used, TLS 1.0 is deprecated, and
client and a server. revision. JavaScript has taken over the
world.
HTTP Overview
● HTTP/1.1 defined in RFC 2616
● Application layer in the ISO/OSI stack
● Based on TCP
HTTP request
● Human readable GET method
● Client-Server architecture
● Stateless
Client Server
HTTP response
OK 200
HTTP Overview
HTTP is used to transfer resources to a client that made a request.
- HTML file
- Images, videos
- Text documents
- …
HTTP Overview - URL
Source: https://developer.mozilla.org/en-US/docs/Learn_web_development/Howto/Web_mechanics/What_is_a_URL
URLs are defined in RFC 1739 and are a type of URI (RFC 3968);
Example:
userinfo host port
https://john.doe@www.example.com:1234/forum/questions/?tag=networking&order=newest#top
└─┬─┘
scheme
https://john.doe@www.example.com:1234/forum/questions/?tag=networking&order=newest#top
└─────────────┬─────────────┘
authority
The host (domain or IP) and port (80 or 443 by default) represent the address to
which the client should send requests.
HTTP Overview - URL
https://john.doe@www.example.com:1234/forum/questions/?tag=networking&order=newest#top
└───────┬───────┘
path
/page.html
/user/32498232
HTTP Overview - URL
https://john.doe@www.example.com:1234/forum/questions/?tag=networking&order=newest#top
└────────────┬────────────┘
query
The query is optional and contains additional parameters provided to the server.
It is a list of key/value pairs separated by &. The values of the parameters must be
encoded using the URLencoding.
HTTP Overview - URLencoding
URL encoding (or percent-encoding), is a format used to encode data in a URI using
ASCII characters.
Example:
https://example.com?msg=Hello World
https://example.com?msg=Hello%20World
HTTP Overview - URLencoding
There is a problem:
HTTP Overview - URL
https://john.doe@www.example.com:1234/forum/questions/?tag=networking&order=newest#top
└┬┘
fragment
The fragment contains the fragment identifier that is used to point to a specific
location inside the resource.
Example:
https://en.wikipedia.org/wiki/Rickrolling#History
HTTP Overview
HTTP is a client-server protocol, this means requests are sent by the client and the
server returns a response. The structure of requests and responses is similar:
Request Response
An HTTP method is one of a set of defined words that describe the meaning of the
request and the desired outcome. In particular:
HTTP status codes indicate the outcome of the request. Responses are grouped in
five classes:
A cookie is a small piece of data a server sends to a client. The client may store or
modify cookies, create a new one, and send them back to the same server with later
requests.
Cookies allows web applications to store limited amounts of data and remember
states.
HTTP Overview - Cookies
A cookie is set by a server using the field Set-Cookie (a server can set multiple
Set-Cookie headers, each one for a separate cookie) inside the headers section of a
response. The format contains a list of key/value separated by a semicolon “;”.
- <cookie-name>=<cookie-value> - Path=<path-value>*
- Domain=<domain-value>* - SameSite=<samesite-value>*
- Expires=<date>* - Secure*
- HttpOnly* - Partitioned*
- Max-Age=<number>*
*Optional
HTTP Overview - Cookies
The first attribute is the cookie name and its value.
cookie-value can optionally be wrapped in double quotes and include any ASCII
character excluding: control characters, whitespace, double quotes, commas,
semicolons and backslashes.
session=e32adc1d09ebc
HTTP Overview - Cookies
Domain defines the host to which the cookie will be sent.
If set, the cookie will be available to the specified domain and all its subdomains.
Domain=example.com
The date is relative to the client the cookie is being set on.
If not specified a cookie will be treated as a session cookie, when the client shuts
down the cookie is removed.
Max-Age indicates the number of seconds until the cookie expires. A zero or
negative number will expire the cookie immediately.
Path=/
Path=/docs
HTTP Overview - Cookies
Samesite controls if a cookie is sent with cross-site requests (requests originating
from a different domain or scheme), providing protection against CSRF (cross-site
request forgery) attacks.
- Strict means the browser sends the cookie only for same-site requests.
- Lax (default) means the cookie is not sent on cross-site requests, but is sent
when the user is navigating to the origin site from an external site.
- None means that the browser sends the cookie with cross-site requests. The
Secure attribute must also be set in this case.
HTTP Overview - Cookies
Secure indicates that the cookie is sent to the server only when the request is made
with https: scheme (except on localhost).
Partitioned indicates that the cookie should be stored using partitioned storage (can
contrasts user tracking).
HTTP Overview - Cookies
HTTP Overview - JWT cookies
JSON Web Token is a new standard for managing authentication.
When logged in, the client receive a JSON signed and/or encrypted and encoded in
Base64 that holds various informations about the user.
eyJhbGciOiJIUzI1NiIsInR5cC {
HEADER
"alg": "HS256",
I6IkpXVCJ9.eyJzdWIiOiIxMjM "typ": "JWT"
}
0NTY3ODkwIiwibmFtZSI6Ikpva
PAYLOAD
G4gRG9lIiwiaWF0IjoxNTE2MjM {
"sub": "1234567890",
5MDIyfQ.SflKxwRJSMeKKF2QT4 "name": "John Doe",
"iat": 1516239022
fwpMeJf36POk6yJV_adQssw5c }
Tooling
Tools
● A browser
● Curl & wget
● Python Requests
● Burp Suite
● Ngrok & Requestbin
● Postman
● Python http.server
The End