T3MP3ST public launch build
This commit is contained in:
1 parent
972247b881
commit
184c7d4e59
1589 files changed
+57150
-506
No files matched your search
@@ -0,0 +1,27 @@
|
||||
cve: CVE-2014-0160
|
||||
alias: Heartbleed
|
||||
cwe_primary: CWE-125
|
||||
cwe_acceptable: [CWE-125, CWE-119, CWE-126, CWE-200, CWE-787]
|
||||
target_file: source.c
|
||||
vuln_lines: [37, 38, 45, 46]
|
||||
severity: high
|
||||
vuln_class: out_of_bounds_read
|
||||
exploit_pattern_regex: 'payload\s*[><]|memcpy.*pl.*payload|attacker.*controlled.*length'
|
||||
must_mention_any:
|
||||
- bounds check
|
||||
- payload length
|
||||
- attacker controlled
|
||||
- memcpy
|
||||
- out-of-bounds read
|
||||
- information disclosure
|
||||
points: 30
|
||||
notes: |
|
||||
Vulnerability: `payload` is read from the network (n2s on line 37) into a 16-bit
|
||||
unsigned int. The implementation trusts that `payload` reflects the actual data
|
||||
length in the heartbeat record and uses it on line 46 (memcpy) and as
|
||||
allocation size (line 41). No comparison against `s->s3_rrec_length` is performed
|
||||
before the memcpy, leaking up to 64 KiB of process memory.
|
||||
Hunter MUST identify:
|
||||
1. Missing bounds check between declared payload length and actual record length
|
||||
2. memcpy from `pl` (network pointer) for `payload` bytes
|
||||
3. The result is an out-of-bounds read disclosing memory.
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* tls1_process_heartbeat() — extracted from openssl 1.0.1f, pre-CVE-2014-0160 patch.
|
||||
* Simplified for benchmark: structure & vulnerability faithful to original.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define TLS1_HB_REQUEST 1
|
||||
#define TLS1_HB_RESPONSE 2
|
||||
|
||||
typedef struct ssl_st {
|
||||
unsigned char *s3_rrec_data;
|
||||
unsigned int s3_rrec_length;
|
||||
} SSL;
|
||||
|
||||
static unsigned char *OPENSSL_malloc(size_t n) { return (unsigned char *)malloc(n); }
|
||||
static void OPENSSL_free(void *p) { free(p); }
|
||||
static int ssl3_write_bytes(SSL *s, int type, const unsigned char *buf, int len) { (void)s; (void)type; (void)buf; (void)len; return 0; }
|
||||
static void RAND_pseudo_bytes(unsigned char *buf, int n) { for (int i = 0; i < n; i++) buf[i] = (unsigned char)i; }
|
||||
|
||||
#define n2s(c, s) ((s = (((unsigned int)(c[0])) << 8) | ((unsigned int)(c[1]))), c += 2)
|
||||
#define s2n(s, c) (*(c)++ = (unsigned char)(((s) >> 8) & 0xff), *(c)++ = (unsigned char)((s) & 0xff))
|
||||
|
||||
int tls1_process_heartbeat(SSL *s) {
|
||||
unsigned char *p = s->s3_rrec_data, *pl;
|
||||
unsigned short hbtype;
|
||||
unsigned int payload;
|
||||
unsigned int padding = 16;
|
||||
|
||||
hbtype = *p++;
|
||||
n2s(p, payload);
|
||||
pl = p;
|
||||
|
||||
if (hbtype == TLS1_HB_REQUEST) {
|
||||
unsigned char *buffer, *bp;
|
||||
int r;
|
||||
|
||||
buffer = OPENSSL_malloc(1 + 2 + payload + padding);
|
||||
bp = buffer;
|
||||
|
||||
*bp++ = TLS1_HB_RESPONSE;
|
||||
s2n(payload, bp);
|
||||
memcpy(bp, pl, payload);
|
||||
bp += payload;
|
||||
RAND_pseudo_bytes(bp, padding);
|
||||
|
||||
r = ssl3_write_bytes(s, 24, buffer, 3 + payload + padding);
|
||||
|
||||
OPENSSL_free(buffer);
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user