Skip to content

Instantly share code, notes, and snippets.

@muellermartin
Created April 14, 2014 23:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muellermartin/10690338 to your computer and use it in GitHub Desktop.
Save muellermartin/10690338 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Clone OpenSSL repository
# Credits to https://github.com/robertdavidgraham/heartleech
git clone git://git.openssl.org/openssl.git
cd openssl
# Build 64-bit library on Mac OS
./configure darwin64-x86_64-cc
make depend
make
# Download latest heartbleed exploit by HackerFantastic
wget https://raw.githubusercontent.com/HackerFantastic/Public/master/exploits/heartbleed.c
# Compile it with Clang using compiled OpenSSL
cc -o heartbleed *.a -lcrypto -I ./include -Wno-return-type heartbleed.c
@Arr0way
Copy link

Arr0way commented Apr 15, 2014

Following the instructions in your script gives me the following on OSX mavericks:

cc -o heartbleed *.a -lcrypto -I ./include -Wno-return-type heartbleed.c
heartbleed.c:335:15: warning: implicit declaration of function 'ssl3_write_bytes' is invalid in C99 [-Wimplicit-function-declaration]
        ret = ssl3_write_bytes(c->sslHandle, TLS1_RT_HEARTBEAT, buf, 3);
              ^
heartbleed.c:360:27: warning: implicit declaration of function 'ssl3_read_n' is invalid in C99 [-Wimplicit-function-declaration]
                        n=ssl3_read_n(s, SSL3_RT_HEADER_LENGTH, s->s3->rbuf.len, 0);
                          ^
heartbleed.c:364:26: warning: assigning to 'char *' from 'unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]
                        p=s->packet;
                         ^~~~~~~~~~
heartbleed.c:397:9: warning: implicit declaration of function 'tls1_enc' is invalid in C99 [-Wimplicit-function-declaration]
        tls1_enc(s,0);
        ^
heartbleed.c:415:25: warning: implicit declaration of function 'ssl3_cbc_copy_mac' is invalid in C99 [-Wimplicit-function-declaration]
                        ssl3_cbc_copy_mac(mac_tmp, rr, mac_size, orig_len);
                        ^
heartbleed.c:422:21: warning: implicit declaration of function 'tls1_mac' is invalid in C99 [-Wimplicit-function-declaration]
                i = tls1_mac(s,md,0);
                    ^
heartbleed.c:439:22: warning: implicit declaration of function 'ssl3_do_uncompress' is invalid in C99 [-Wimplicit-function-declaration]
                if (!ssl3_do_uncompress(s)) {
                     ^
heartbleed.c:454:9: warning: initializing 'char *' with an expression of type 'unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]
                char* fp = s->s3->rrec.data;
                      ^    ~~~~~~~~~~~~~~~~
heartbleed.c:455:3: warning: expression result unused [-Wunused-value]
                (long)fp++;
                ^     ~~~~
heartbleed.c:656:10: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
                        if(pid=fork()){
                           ~~~^~~~~~~
heartbleed.c:656:10: note: place parentheses around the assignment to silence this warning
                        if(pid=fork()){
                              ^
                           (         )
heartbleed.c:656:10: note: use '==' to turn this assignment into an equality comparison
                        if(pid=fork()){
                              ^
                              ==

@Eyeless77
Copy link

Same issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment