{"id":18265882,"url":"https://github.com/mpgn/heartbleed-poc","last_synced_at":"2025-04-04T21:32:15.734Z","repository":{"id":28349554,"uuid":"31863201","full_name":"mpgn/heartbleed-PoC","owner":"mpgn","description":":broken_heart: Hearbleed exploit to retrieve sensitive information CVE-2014-0160 :broken_heart:","archived":false,"fork":false,"pushed_at":"2021-02-20T19:41:03.000Z","size":140,"stargazers_count":77,"open_issues_count":2,"forks_count":43,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-05-02T01:55:42.199Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mpgn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-08T19:54:33.000Z","updated_at":"2024-01-26T09:40:23.000Z","dependencies_parsed_at":"2022-08-17T21:50:50.149Z","dependency_job_id":null,"html_url":"https://github.com/mpgn/heartbleed-PoC","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpgn%2Fheartbleed-PoC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpgn%2Fheartbleed-PoC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpgn%2Fheartbleed-PoC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpgn%2Fheartbleed-PoC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mpgn","download_url":"https://codeload.github.com/mpgn/heartbleed-PoC/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223159552,"owners_count":17097492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T11:20:26.845Z","updated_at":"2024-11-05T11:20:27.432Z","avatar_url":"https://github.com/mpgn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Heartbleed PoC\n===========\n\nA sample example of the [Heartbleed](http://en.wikipedia.org/wiki/Heartbleed) attack using the server https://www.cloudflarechallenge.com/ made for trying this attack.\n\nFirst, the two best explanations I read on the subject :\n* http://www.seancassidy.me/diagnosis-of-the-openssl-heartbleed-bug.html \n* http://xkcd.com/1354/\n\n## Exploit\n\nThe exploit start by sending the handshake to the server *cloudflarechallenge.com* to create the secure connection with tls. Then the function `hit_hb(s)` send a typycall heartbeat request :\n```\nhb = h2bin('''\n18 03 02 00 03\n01 40 00\n''')\n````\n\n* Explanation of heartbeat (bf)call : \u003cbr\u003e\n    18      : hearbeat record  \u003cbr\u003e\n    03 02   : TLS version  \u003cbr\u003e\n    00 03   : length  \u003cbr\u003e\n    01      : hearbeat request  \u003cbr\u003e\n    40 00   : payload length 16 384 bytes check rfc6520  \u003cbr\u003e\n                \"The total length of a HeartbeatMessage MUST NOT exceed 2^14\"\n                If we enter FF FF -\u003e 65 535, we will received 4 paquets of length 16 384 bytes\n                \nWe wait for the response of the server and then we unpack 5 bytes (the header) of the tls packet `(content_type, version, length) = struct.unpack('\u003eBHH', hdr)`\n\nAfter that we read the rest of the request due to the length we get from the header.\nThe data are stored in the file `òut.txt`.\n                \n**Note**: the attack can be [made in the handshake phase](http://security.stackexchange.com/a/55117/41351) before the encryption but for simplicity, this exploit start after the handshake. \n\n## Run it !\n\nYou must have python `2.7.*` installed on your computer (not tested on python 3)\n\n```\npython2 heartbleed-exploit.py www.cloudflarechallenge.com\n```\n\nThen you will see somehting like this :\n\n![heartbleed](https://i.gyazo.com/ccd58098438eff4124bf1e9bb9776ae5.png)\n\nThen you can check the file `out.txt` to see `2^14 (40 00)` of data contained in the memory of the serveur instead of 4 !\nYou can run the exploit many time, you will have different résult in the file. \n\n**/!\\ WARNING** the file will be overwritten after each execution of the exploit\n\n##Ressources and thanks\n\n* http://en.wikipedia.org/wiki/Heartbleed\n* https://github.com/Lekensteyn/pacemaker/blob/master/pacemaker.py#L19\n* https://gist.github.com/sh1n0b1/10100394\n* https://github.com/openssl/openssl/commit/96db9023b881d7cd9f379b0c154650d6c108e9a3\n* https://hacking.ventures/rsa-keys-in-heartbleed-memory/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpgn%2Fheartbleed-poc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpgn%2Fheartbleed-poc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpgn%2Fheartbleed-poc/lists"}