Skip to content

Commit 4c3a30e

Browse files
authored
THM
1 parent 3879771 commit 4c3a30e

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

Day5/notes

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Heartbleed:
2+
3+
Introduction to Heartbleed and SSL/TLS:
4+
On the internet today, most web servers are configured to use SSL/TLS.
5+
SSL(secure socket layer) is just a predecessor to TLS(transport layer security).
6+
The most common versions are TLS 1.2 and TLS 1.3(which has recently been released).
7+
Configuring a web server to use TLS means that all communication from that particular server to a client will be encrypted;
8+
any malicious third party that has access to this traffic will not be able to understand/decrypt the traffic, and they also will not be able to modify the traffic.
9+
To learn more about how the TLS connections are established
10+
11+
12+
Heartbleed is a bug due to the implementation in the OpenSSL library from versions 1.0.1 to 1.0.1f(which is very widely used).
13+
It allows a user to access memory on the server(which they usually wouldn't have access to).
14+
This in turn allows a malicious user to access different kinds of information(that they wouldn't usually have access to due to the encryption and integrity provided by TLS) including:
15+
16+
-> server private key
17+
-> confidential data like usernames, passwords and other personal information
18+
19+
20+
Analysing the Bug
21+
22+
23+
The implementation error occurs in the heartbeat message that is used by OpenSSL to keep a connection alive even when no data is sent.
24+
A mechanism like this is important because if a connection dies/resets quite often, it would be expensive to set up the TLS aspect of the connection again;
25+
this affects the latency across the internet and it would make using services slow for users.
26+
A heartbeat message sent by one end of the connection contains random data and the length of the data, and this exact data is sent back when received by the other end of the connection.
27+
When the server retrieves this message from the client here's what it does:
28+
29+
-> The server constructs a pointer(memory location) to the heartbeat record
30+
31+
-> It then copies the length of the data sent by a user into a variable(called payload)
32+
33+
The length of this data is unchecked
34+
35+
-> The server then allocates memory in the form of:
36+
37+
1 + 2 + payload + padding(this can be maximum of 1 + 2 + 65535 + 16)
38+
39+
-> The server then creates another pointer(bp) to access this memory
40+
41+
-> The server then copies payload number of bytes from data sent by the user to the bp pointer
42+
43+
-> The server sends the data contained in the bp pointers to the user
44+
45+
With this, you can see that the user controls the amount and length of data they send over.
46+
If the user does not send over any data(where the length is 0), it means that the server will copy arbitrary memory into the new pointer(which is how it can access secret information on the server).
47+
When retrieving data this way, the data can be different with different responses as the memory on the server will change.

0 commit comments

Comments
 (0)