[confidence] fuzz your way into web server's zoo

86
Andrey Plastunov Digital Security (dsec.ru) Fuzz your way into the web server’s zoo

Upload: andrey-plastunov

Post on 08-Aug-2015

83 views

Category:

Software


1 download

TRANSCRIPT

Page 1: [Confidence] Fuzz your way into web server's zoo

Andrey PlastunovDigital Security (dsec.ru)

Fuzz your way into the web server’s zoo

Page 2: [Confidence] Fuzz your way into web server's zoo

● Pentester at dsec.ru [ ]@DSecRU

@plastunovaa@osakaaa

[email protected]

[About]

Page 3: [Confidence] Fuzz your way into web server's zoo

[Agenda]

Page 4: [Confidence] Fuzz your way into web server's zoo

[The Zoo]

Page 5: [Confidence] Fuzz your way into web server's zoo

➢ Web proxies

[The Zoo]

Page 6: [Confidence] Fuzz your way into web server's zoo

➢ Web proxies○ Content-filtering

[The Zoo]

Page 7: [Confidence] Fuzz your way into web server's zoo

➢ Web proxies○ Content-filtering○ Tunneling

[The Zoo]

Page 8: [Confidence] Fuzz your way into web server's zoo

➢ Web proxies○ Content-filtering○ Tunneling○ ...

[The Zoo]

Page 9: [Confidence] Fuzz your way into web server's zoo

➢ Web proxies➢ Embedded systems

[The Zoo]

Page 10: [Confidence] Fuzz your way into web server's zoo

➢ Web proxies➢ Embedded systems

○ Routers and other network devices

[The Zoo]

Page 11: [Confidence] Fuzz your way into web server's zoo

➢ Web proxies➢ Embedded systems

○ Routers and other network devices

○ Industrial devices

[The Zoo]

Page 12: [Confidence] Fuzz your way into web server's zoo

➢ Web proxies➢ Embedded systems

○ Routers and other network devices

○ Industrial devices○ ...

[The Zoo]

Page 13: [Confidence] Fuzz your way into web server's zoo

➢ Web proxies➢ Embedded systems➢ Non-default modules

in mainstream servers

[The Zoo]

Page 14: [Confidence] Fuzz your way into web server's zoo

➢ Web proxies➢ Embedded systems➢ Non-default modules

in mainstream servers➢ Other software

[The Zoo]

Page 15: [Confidence] Fuzz your way into web server's zoo

➢ Web proxies➢ Embedded systems➢ Non-default modules

in mainstream servers➢ Other software------------------------------➔ Clients

[The Zoo]

Page 16: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

Page 17: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

POST /do/not/touch?my=server HTTP/1.1HOST: www.victim.comUser-Agent: Fuzzy browserContent-Type: text/htmlContent-Length: 42

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaa!!!!1111

Page 18: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

POST /do/not/touch?my=server HTTP/1.1\r\nHOST: www.victim.com\r\nUser-Agent: Fuzzy browser\r\nContent-Type: text/html\r\nContent-Length: 42\r\n\r\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaa!!!!1111\r\n

Page 19: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

POST /do/not/touch?my=server HTTP/1.1

Page 20: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

POST /do/not/touch?my=server HTTP/1.1

Method

Page 21: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

POST /do/not/touch?my=server HTTP/1.1

MethodMethods:STANDARD: GET POST HEAD OPTIONS TRACE CONNECT PUT DELETEWEBDAV: PROPFIND PROPPATH MKCOL COPY MOVE LOCK UNLOCK + versioning extensionsCUSTOM: Anything a developer can imagine (e.g. VALIDATE, CURATE, etc.)

Page 22: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

POST /do/not/touch?my=server HTTP/1.1

Method[fuzzable]

Page 23: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

POST /do/not/touch?my=server HTTP/1.1

Method[fuzzable]

URI

Page 24: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

POST /do/not/touch?my=server HTTP/1.1

Method[fuzzable]

URI[fuzzable]

Page 25: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

POST /do/not/touch?my=server HTTP/1.1

Method[fuzzable]

URI[fuzzable]

parameters

Page 26: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

POST /do/not/touch?my=server HTTP/1.1

Method[fuzzable]

URI[fuzzable]

parameters[fuzzable]

Page 27: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

POST /do/not/touch?my=server HTTP/1.1

Method[fuzzable]

URI[fuzzable]

parameters[fuzzable]

protocol version

Page 28: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

POST /do/not/touch?my=server HTTP/1.1

Method[fuzzable]

URI[fuzzable]

parameters[fuzzable]

protocol version[fuzzable?]

Page 29: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

POST http://server.name/do/not/touch?my=server HTTP/1.1

URI[fuzzable]

parameters[fuzzable]

protocol version[fuzzable?]

In case of connecting via proxy:

Method[fuzzable]

Server name

Page 30: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

POST http://server.name/do/not/touch?my=server HTTP/1.1

URI[fuzzable]

parameters[fuzzable]

protocol version[fuzzable?]

In case of connecting via proxy:

Method[fuzzable]

Server name[fuzzable]

Page 31: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

HOST: www.victim.com User-Agent: Fuzzy browser

Content-Type: text/html Content-Length: 42

Page 32: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

HOST: www.victim.com User-Agent: Fuzzy browser

Content-Type: text/html Content-Length: 42

Values

Page 33: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

HOST: www.victim.com User-Agent: Fuzzy browser

Content-Type: text/html Content-Length: 42

Values

Some google.com examples of complex headers:

Cookie: PREF=ID=d58a20b32d82347c:U=866f4da1ca2cc94c:FF=0:TM=1432555395:LM=1432555397:S=DzXF-knTmsVgJcCF; NID=67=H71Q3BwamddYRlgS5a9N0AZ1UqRAbcOcVORM3AJ3pb7i8WajPH7QDWuWNx5AYUvqBqrysr0QeuqG5QZfjJmEIMLoCSoPF0nA307pAb9GgmmA0Rl8Pg1ls8g4106DEbSz

Page 34: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

HOST: www.victim.com User-Agent: Fuzzy browser

Content-Type: text/html Content-Length: 42

Values[fuzzable]

Page 35: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

HOST: www.victim.com User-Agent: Fuzzy browser

Content-Type: text/html Content-Length: 42

Values[fuzzable]pair(header:value)

Page 36: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

HOST: www.victim.com User-Agent: Fuzzy browser

Content-Type: text/html Content-Length: 42

Values[fuzzable]pair(header:value)[fuzzable]

Page 37: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

name=post_example&very_tricky_parameter=hi!

Content-type: application/x-www-form-urlencoded

Page 38: [Confidence] Fuzz your way into web server's zoo

[The HTTP]Content-type: application/x-www-form-urlencoded

name=post_example&very_tricky_parameter=hi!

Same as for URL data: [fuzzable]

Page 39: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

---Boundary_valueContent-Disposition: form-data; name=”description”

test---Boundary_valueContent-Disposition: form-data; name=”file_content” filename=”test.dat”

\xde\xad\xbe\xef

---Boundary_value

Content-type: multipart/form-data

Page 40: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

---Boundary_valueContent-Disposition: form-data; name=”description”

test---Boundary_valueContent-Disposition: form-data; name=”file_content” filename=”test.dat”

\xde\xad\xbe\xef

---Boundary_value

Content-type: multipart/form-datadata header

Page 41: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

---Boundary_valueContent-Disposition: form-data; name=”description”

test---Boundary_valueContent-Disposition: form-data; name=”file_content” filename=”test.dat”

\xde\xad\xbe\xef

---Boundary_value

Content-type: multipart/form-datadata header[fuzzable]

Page 42: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

---Boundary_valueContent-Disposition: form-data; name=”description”

test---Boundary_valueContent-Disposition: form-data; name=”file_content” filename=”test.dat”

\xde\xad\xbe\xef

---Boundary_value

Content-type: multipart/form-datadata header[fuzzable]

mime parameter

Page 43: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

---Boundary_valueContent-Disposition: form-data; name=”description”

test---Boundary_valueContent-Disposition: form-data; name=”file_content” filename=”test.dat”

\xde\xad\xbe\xef

---Boundary_value

Content-type: multipart/form-data

mime parameter[fuzzable]

data header[fuzzable]

Page 44: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

---Boundary_valueContent-Disposition: form-data; name=”description”

test---Boundary_valueContent-Disposition: form-data; name=”file_content” filename=”test.dat”

\xde\xad\xbe\xef

---Boundary_value

Content-type: multipart/form-data

plain text value

data header[fuzzable]

mime parameter[fuzzable]

Page 45: [Confidence] Fuzz your way into web server's zoo

---Boundary_valueContent-Disposition: form-data; name=”description”

test---Boundary_valueContent-Disposition: form-data; name=”file_content”; filename=”test.dat”

\xde\xad\xbe\xef

---Boundary_value

[The HTTP]Content-type: multipart/form-data

plain text value[fuzzable]

data header[fuzzable]

mime parameter[fuzzable]

Page 46: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

---Boundary_valueContent-Disposition: form-data; name=”description”

test---Boundary_valueContent-Disposition: form-data; name=”file_content”; filename=”test.dat”

\xde\xad\xbe\xef

---Boundary_value

Content-type: multipart/form-data

binary value

plain text value[fuzzable]mime parameter[fuzzable]

data header[fuzzable]

Page 47: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

---Boundary_valueContent-Disposition: form-data; name=”description”

test---Boundary_valueContent-Disposition: form-data; name=”file_content”; filename=”test.dat”

\xde\xad\xbe\xef

---Boundary_value

Content-type: multipart/form-data

binary value[fuzzable]

plain text value[fuzzable]mime parameter[fuzzable]

data header[fuzzable]

Page 48: [Confidence] Fuzz your way into web server's zoo

[The HTTP]POST /do/not/touch?my=server HTTP/1.1\r\nHOST: www.victim.com\r\nUser-Agent: Fuzzy browser\r\nAccept: text/html,application/xml\r\n Content-Type: text/html\r\nCookie: id=olololo;TheAnswer=42Content-Length: 42\r\n\r\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaa!!!!1111\r\n

Page 49: [Confidence] Fuzz your way into web server's zoo

[The HTTP]

Delimiters

POST /do/not/touch?my=server HTTP/1.1\r\nHOST: www.victim.com\r\nUser-Agent: Fuzzy browser\r\nAccept: text/html,application/xml\r\n Content-Type: text/html\r\nCookie: id=olololo;TheAnswer=42Content-Length: 42\r\n\r\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaa!!!!1111\r\n

Page 50: [Confidence] Fuzz your way into web server's zoo

[The HTTP]POST /do/not/touch?my=server HTTP/1.1\r\nHOST: www.victim.com\r\nUser-Agent: Fuzzy browser\r\nAccept: text/html,application/xml\r\n Content-Type: text/html\r\nCookie: id=olololo;TheAnswer=42Content-Length: 42\r\n\r\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaa!!!!1111\r\n

Delimiters[fuzzable]

Page 51: [Confidence] Fuzz your way into web server's zoo

[Fuzzing approaches]

Page 52: [Confidence] Fuzz your way into web server's zoo

Web Server

Client(Fuzzer)

[Straight fuzzing]

Page 53: [Confidence] Fuzz your way into web server's zoo

Web Server

Client(Fuzzer)

(FUZZ) HTTP REQUEST

[Straight fuzzing]

Page 54: [Confidence] Fuzz your way into web server's zoo

Web Server

Client(Fuzzer)

(FUZZ) HTTP REQUEST

HTTP RESPONSE

[Straight fuzzing]

Page 55: [Confidence] Fuzz your way into web server's zoo

Web Server

(Fuzzer)Client

[Reverse fuzzing]

Page 56: [Confidence] Fuzz your way into web server's zoo

Web Server

(Fuzzer)Client

HTTP REQUEST

[Reverse fuzzing]

Page 57: [Confidence] Fuzz your way into web server's zoo

Web Server

(Fuzzer)Client

HTTP REQUEST

(FUZZ) HTTP RESPONSE

[Reverse fuzzing]

Page 58: [Confidence] Fuzz your way into web server's zoo

Web Server

(Fuzzer)Client

HTTP REQUEST

(FUZZ) HTTP RESPONSE

[Reverse fuzzing]

Difficulties:➢ There is no possibility to check the

client’s health by directly communicating with it

➢ Additional tweaks needed to re-run the client after each request

Page 59: [Confidence] Fuzz your way into web server's zoo

Web Server

(Fuzzer)

Client(Fuzzer)

HTTPProxy

[Double fuzzing]

Page 60: [Confidence] Fuzz your way into web server's zoo

Web Server

(Fuzzer)

Client(Fuzzer)

HTTPProxy

[Double fuzzing]

(FUZZ) HTTP REQUEST

Page 61: [Confidence] Fuzz your way into web server's zoo

Web Server

(Fuzzer)

Client(Fuzzer)

HTTPProxy

(FUZZ) HTTP REQUEST

[Double fuzzing]

Page 62: [Confidence] Fuzz your way into web server's zoo

Web Server

(Fuzzer)

Client(Fuzzer)

HTTPProxy

(FUZZ) HTTP REQUEST

[Double fuzzing]

(FUZZ) HTTP RESPONSE

Page 63: [Confidence] Fuzz your way into web server's zoo

Web Server

(Fuzzer)

Client(Fuzzer)

HTTPProxy

(FUZZ) HTTP REQUEST

[Double fuzzing]

(FUZZ) HTTP RESPONSE

Page 64: [Confidence] Fuzz your way into web server's zoo

[The detection]

Page 65: [Confidence] Fuzz your way into web server's zoo

➢ Traffic analysis

[The detection]

Page 66: [Confidence] Fuzz your way into web server's zoo

➢ Traffic analysis➢ Local process monitoring

[The detection]

Page 67: [Confidence] Fuzz your way into web server's zoo

➢ Traffic analysis➢ Local process monitoring➢ Some heuristics based on responses from

target

[The detection]

Page 68: [Confidence] Fuzz your way into web server's zoo

➢ Traffic analysis➢ Local process monitoring➢ Some heuristics based on responses from

target○ Comparing with reference response

[The detection]

Page 69: [Confidence] Fuzz your way into web server's zoo

p.s. still alpha version :-)

[The wuzzer]

Page 70: [Confidence] Fuzz your way into web server's zoo

[The wuzzer]

Generator

Queue Transmitter Target

Monitor

1.Task

2.Task

Wuzzer Target

4. Statistic

6. ResultsLog

3.REQ

5. RESP

7. Results

Page 71: [Confidence] Fuzz your way into web server's zoo

[The wuzzer]

Generator

Queue Transmitter Target

Monitor

1.Task

2.Task

Wuzzer Target

4. Statistic

6. ResultsLog

3.REQ

5. RESP

7. Results

Page 72: [Confidence] Fuzz your way into web server's zoo

[The wuzzer]

Generator

Queue Transmitter Target

Monitor

1.Task

2.Task

Wuzzer Target

4. Statistic

6. ResultsLog

3.REQ

5. RESP

7. Results

Paid advertisement =)

PyZZUF by @nezlooyhttps://github.com/nezlooy/pyZZUF

Page 73: [Confidence] Fuzz your way into web server's zoo

[The wuzzer]

Generator

Queue Transmitter Target

Monitor

1.Task

2.Task

Wuzzer Target

4. Statistic

6. ResultsLog

3.REQ

5. RESP

7. Results

Page 74: [Confidence] Fuzz your way into web server's zoo

[The wuzzer]

Generator

Queue Transmitter Target

Monitor

1.Task

2.Task

Wuzzer Target

4. Statistic

6. ResultsLog

3.REQ

5. RESP

7. Results

Page 75: [Confidence] Fuzz your way into web server's zoo

[The wuzzer]

Generator

Queue Transmitter Target

Monitor

1.Task

2.Task

Wuzzer Target

4. Statistic

6. ResultsLog

3.REQ

5. RESP

7. Results

Page 76: [Confidence] Fuzz your way into web server's zoo

[The wuzzer]

Look for the wuzzer updates at

https://www.github.com/osakaaa

Page 77: [Confidence] Fuzz your way into web server's zoo

[The examples]

Page 78: [Confidence] Fuzz your way into web server's zoo

Content-Length: -2➢ An Integer Overflow causes a memory

consumption bug

[The examples]

Page 79: [Confidence] Fuzz your way into web server's zoo

[The examples]

Content-Length: 601

Crash due to an unhandled exception in strcpy_s

Page 80: [Confidence] Fuzz your way into web server's zoo

[The examples]

Content-Length: 601

Crash due to an unhandled exception in strcpy_s

Page 81: [Confidence] Fuzz your way into web server's zoo

Content-Length: -0Integer Overflow causes Stack Buffer Overflow

[The examples]

Page 82: [Confidence] Fuzz your way into web server's zoo

Authorization: BasicLogin name > 16kbCauses stack buffer overflow (??)

[The examples]

Page 83: [Confidence] Fuzz your way into web server's zoo

Accept-language: en-US,,,,<1000>,,,,,ru-RUBuffer Overflow (???)

[The examples]

Page 84: [Confidence] Fuzz your way into web server's zoo

MS15-034:Range: Bytes: 18-18446744073709551615Integer Overflow

[The examples]

Page 85: [Confidence] Fuzz your way into web server's zoo

CVE:2014-5289: Long URI in POST request :POST /AAAAAAA….<736>...AAAAAStack Buffer Overflow

[The examples]

Page 86: [Confidence] Fuzz your way into web server's zoo

[The end]