Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
The RFC 6520 Heartbeat Extension tests TLS/DTLS secure communication links by allowing a computer at one end of a connection to send a «Heartbeat Request» message, consisting of a payload, typically a text string, along with the payload's length as a 16-bit integer. The receiving computer then must send exactly the same payload back to the sender.
The affected versions of OpenSSL allocate a memory buffer for the message to be returned based on the length field in the requesting message, without regard to the actual size of that message's payload. Because of this failure to do proper bounds checking, the message returned consists of the payload, possibly followed by whatever else happened to be in the allocated memory buffer.
module Heartbleed where
import System.IO
import Data.Array.IO
import Data.Word
copy :: String -> String -> IOUArray Int Word8 -> IO ()
copy from to buffer = do
from' <- openFile from ReadMode
to' <- openFile to WriteMode
c <- hGetArray from' buffer 250
hPutArray to' buffer 250
hClose from'
hClose to'
main = do
buffer <- newArray_ (0,250)
copy "yourping" "yourecho" buffer
copy "myping" "myecho" buffer
~/Tmp -$ cat yourecho limbo-home@chemist :)
#i have many secrets. this is one.
�8d��=��d�T�% ~/Tmp -$ cat myecho limbo-home@chemist :)
#i know your
secrets. this is one.
�8d��=��d�T�%
Heartbleed на Rust