76
1 29/01/2019 Wireshark Basics 414C504F

Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

  • Upload
    others

  • View
    22

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

1 29/01/2019

Wireshark Basics

414C504F

Page 2: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

2 29/01/2019

Contents

• Traffic capture and traffic filtering with

Wireshark

• SSL ManInTheMiddle with Wireshark

• WLAN traffic ManInTheMiddle with

Wireshark

Page 3: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

3 29/01/2019

Wireshark

• Packet analyser / traffic sniffer

• Open-source

• Cross-platform

• Fancy GUI

• https://www.wireshark.org/

Page 4: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

4 29/01/2019

Data packets capturing

To start capturing

• Select a network interface

• Click on the blue shark fin

button / press Ctrl + E

To stop capturing st capturing

• Click on the red stop

button / press Ctrl + E

Page 5: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

5 29/01/2019

Data packets capturing

Page 6: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

6 29/01/2019

Data packets capturing

Top frame:

Number | Time | Source | Destination | Protocol | Length | Info

Middle frame example:st capturing

> Frame

> Linux cooked capture

> Internet protocol version, source, destination

> Transmission control protocol, src port, dst port, seq, len

Bottom frame:

Data

Page 7: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

7 29/01/2019

Data packets capturing

Top frame:

Number | Time | Source | Destination | Protocol | Length | Info

Middle frame example:st capturing

> Frame

> Linux cooked capture

> Internet protocol version, source, destination

> Transmission control protocol, src port, dst port, seq, len

Bottom frame:

Data

Page 8: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

8 29/01/2019

Data packets capturing

Top frame:

Number | Time | Source | Destination | Protocol | Length | Info

Middle frame example:st capturing

> Frame

> Linux cooked capture

> Internet protocol version, source, destination

> Transmission control protocol, src port, dst port, seq, len

Bottom frame:

Data

Page 9: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

9 29/01/2019

Data packets capturing

Top frame:

Number | Time | Source | Destination | Protocol | Length | Info

Middle frame example:st capturing

> Frame

> Linux cooked capture

> Internet protocol version, source, destination

> Transmission control protocol, src port, dst port, seq, len

Bottom frame:

Data

Page 10: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

10 29/01/2019

Wireshark Filters

There are 2 ways to filter:

• Build a filter via the fancy GUI (Expression button)

• Type a filter into the “Apply a display filter” entry

field (below the toolbar)

• https://wiki.wireshark.org/DisplayFilters

Page 11: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

11 29/01/2019

Wireshark Filters

There are 2 ways to filter:

• Build a filter via the fancy GUI (Expression button)

• Type a filter into the “Apply a display filter” entry

field (below the toolbar)

• https://wiki.wireshark.org/DisplayFilters

Page 12: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

12 29/01/2019

Wireshark Filters Relations

English C-like Description and example

eq == Equal. ip.src==10.0.0.5

ne != Not equal. ip.src!=10.0.0.5

gt > Greater than. frame.len > 10

lt < Less than. frame.len < 128

ge >= Greater than or equal to. frame.len ge 0x100

le <= Less than or equal to. frame.len ⇐ 0x20

contains Protocol, field or slice contains a value. sip.To contains

"a1762"

matches ~ Protocol or text field match Perl regualar expression.

http.host matches "acme\.(org|com|net)"

bitwise_and & Compare bit field value. tcp.flags & 0x02

Source: https://www.wireshark.org/docs/wsug_html_chunked/ChWorkBuildDisplayFilterSection.html

Page 13: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

13 29/01/2019

Wireshark Combining Expressions

English C-like Description and example

and && Logical AND. ip.src==10.0.0.5 and tcp.flags.fin

or || Logical OR. ip.scr==10.0.0.5 or ip.src==192.1.1.1

xor ^^ Logical XOR. tr.dst[0:3] == 0.6.29 xor tr.src[0:3] ==

0.6.29

not ! Logical NOT. not llc

[… ] Slice Operator. eth.addr[0:3]==00:06:5B

in Membership Operator. tcp.port in {80 443 8080}

Source: https://www.wireshark.org/docs/wsug_html_chunked/ChWorkBuildDisplayFilterSection.html https://wiki.wireshark.org/DisplayFilters

Page 14: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

14 29/01/2019

Most common Wireshark filters

tcp.port eq 80

tcp.srcport==443

Filter for HTTP and HTTPS traffic:

tcp.port==443 or tcp.port==80

ssl or http

tcp.port in {80 443 8080}

tcp.port == 80 || tcp.port == 443 || tcp.port == 8080

Page 15: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

15 29/01/2019

Most common Wireshark filters

Filter for a protocol:

tcp

udp

dns

IP addresses:

ip.addr == 10.43.54.65

! ( ip.addr == 10.43.54.65 )

Page 16: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

16 29/01/2019

Most common Wireshark filters

Examples for web traffic:

http.request.uri == https://www.wireshark.org/

http.host matches "acme\.(org|com|net)"

http.response.code == 200

http.request.method == "GET“

tcp contains "admin"

Page 17: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

17 29/01/2019

Wireshark filters logic

Filter for http traffic with specific addresses and frame

time and not 200 response (e.g. you want to see 301

Moved permanently and 500 Server error packets):

http && ( (ip.dst == 192.168.178.27 ) || (ip.dst == 193.70.91.56 ) ) && frame.time > "2019-01-24 00:01:00.0000" && frame.time < "2019-01-25 15:01:53.0000" && http.response.code != 200

Page 18: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

18 29/01/2019

Follow the stream

Select a Packet > Right

mouse click > Follow >

HTTP Stream

Page 19: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

19 29/01/2019

What if I told you…

That you can sort the traffic just by clicking the

colomn names...

That you can search for strings in packets using Edit >

Find Packet... (Ctrl+F)

Page 20: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

20 29/01/2019

Contents

• SSL ManInTheMiddle with Wireshark (Linux

edition)

Page 21: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

21 29/01/2019

SSL ManInTheMiddle with Wireshark

To test the decryption of SSL traffic with Wireshark:

• Create private keys of the server and the client

• Start a server which uses the certificate with the key

and send some test packets

• Configure Wireshark

Page 22: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

22 29/01/2019

Create certificates

Create a server certificate

# openssl req -new -x509 -out server.crt -nodes -keyout server.pem -subj /CN=localhost

Create a client certificate

# openssl req -new -x509 -nodes -out client.crt -keyout client.key -subj /CN=Moi/O=Foo/C=NL

Page 23: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

23 29/01/2019

Start a server

Start a server at localhost:4443

# openssl s_server -cipher AES256-SHA -accept 4443 -www -CAfile client.crt -verify 1 -key server.pem -cert server.crt

Page 24: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

24 29/01/2019

Start a server

Start a server at localhost:4443

build7R7 1 # openssl s_server -cipher AES256-SHA -accept 4443 -www -CAfile client.crt -verify 1 -key server.pem -cert server.crt

Page 25: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

25 29/01/2019

Send a request with python(3) and stop

the capture

import urllib.request import ssl context = ssl._create_unverified_context() with urllib.request.urlopen("https://localhost:4443/", context=context) as url: s = url.read() print(s)

Page 26: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

26 29/01/2019

Traffic captured

Page 27: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

27 29/01/2019

Configure wireshark

Edit > Preferences

On the left: Protocols > SSL

RSA keys list: press „Edit...“ and add via „+“

IP address – any

Port – 4443

Protocol – http

Key file – /.../server.pem

Password –

Page 28: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

28 29/01/2019

Configure wireshark

Edit > Preferences

On the left: Protocols > SSL

RSA keys list: press „Edit...“ and add via „+“

IP address – any

Port – 4443

Protocol – http

Key file – /.../server.pem

Password –

Page 29: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

29 29/01/2019

Configure wireshark

SSL debug file (file with decrypted output):

/.../wiresharklog.txt

Check „Reassemble SSL records spanning multiple TCP segments“

Check „Reassemble SSL Application Data spanning multiple SSL records“

Don’t check “Message Authentication Code (MAC), ignore “mac failed”

Pre-Shared-Key (left empty):

(Pre)-Master-Secret log filename:

/.../client.key

Page 30: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

30 29/01/2019

Configure wireshark

SSL debug file (file to look for decrypted output!):

/.../wiresharklog.txt

Check „Reassemble SSL records spanning multiple TCP segments“

Check „Reassemble SSL Application Data spanning multiple SSL records“

Don’t check “Message Authentication Code (MAC), ignore “mac failed”

Pre-Shared-Key (left empty):

(Pre)-Master-Secret log filename:

/.../client.key

Page 31: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

31 29/01/2019

Enjoy the decryption

Page 32: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

32 29/01/2019

Enjoy the decryption (proof)

Page 33: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

33 29/01/2019

SSL ManInTheMiddle (the easy way)

Set the SSLKEYLOGFILE environment variable and enter

it’s value under (Pre)-Master-Secret log filename.

https://jimshaver.net/2015/02/11/decrypting-tls-

browser-traffic-with-wireshark-the-easy-way/

Page 35: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

35 29/01/2019

Contents

• WLAN traffic ManInTheMiddle with

Wireshark

Page 36: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

36 29/01/2019

Data packets capturing

To start capturing

• Select the WLAN network

interface

• Click on the blue shark fin

button / press Ctrl + E

Page 37: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

37 29/01/2019

Example: Establishing a WLAN connection

Page 38: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

38 29/01/2019

Example: HTTP/HTTPS traffic capture on wlan0

interface

Page 39: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

39 29/01/2019

Decrypt traffic with a known key

Edit > Preferences

On the left: Protocols > IEEE 802.11

And add a decryption key

Page 40: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

40 29/01/2019

Decrypt with known key

Edit > Preferences

On the left: Protocols > IEEE 802.11

And add a decryption key

Page 41: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

41 29/01/2019

Further reading

Aircrack-ng

https://www.aircrack-ng.org/

https://tools.kali.org/wireless-attacks/aircrack-ng

EAPOL

https://security.stackexchange.com/questions/66008

/how-exactly-does-4-way-handshake-cracking-work

Page 42: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

42 29/01/2019

Wireshark Advanced

414C504F

Page 43: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

43 29/01/2019

Contents

• Wireshark parsers (dissectors)

Page 44: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

44 29/01/2019

Wireshark dissectors

Disscectors are parsers/custom scripts to analize

packets’ data.

Can be implemented

• In Lua language

• In C language

Page 45: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

45 29/01/2019

Wireshark Lua dissectors

helloworld.lua (saved under /usr/lib/x86_64-linux-

gnu/wireshark/plugins/2.2.6/test/helloworld.lua):

local splash = TextWindow.new("Hello World!");

Page 46: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

46 29/01/2019

Wireshark Lua dissectors

The dissector will be executed on Wireshark’s start. The script

has to be saved in the Plugin directory in this case, e.g.

# locate wireshark | grep -iE 'plugins'

/usr/lib/x86_64-linux-gnu/wireshark/plugins/2.2.6

Alternatively, you can enforce the execution of a Lua dissector by

running the dofile command under Tools > Lua > Evaluate

dofile("path/to/file.lua")

Page 47: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

47 29/01/2019

Wireshark Lua dissectors

The dissector will be executed on Wireshark’s start. The script

has to be saved in the Plugin directory, e.g.

# locate wireshark | grep -iE 'plugins'

/usr/lib/x86_64-linux-gnu/wireshark/plugins/2.2.6

Alternatively, you can enforce the execution of a Lua dissector by

running the dofile command under Tools > Lua > Evaluate

dofile("path/to/file.lua")

Page 48: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

48 29/01/2019

Wireshark Lua dissectors

The dissector will be executed on Wireshark’s start. The script

has to be saved in the Plugin directory, e.g.

# locate wireshark | grep -iE 'plugins'

/usr/lib/x86_64-linux-gnu/wireshark/plugins/2.2.6

Alternatively, you can enforce the execution of a Lua dissector by

running the dofile command under Tools > Lua > Evaluate

dofile("path/to/file.lua")

Page 49: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

49 29/01/2019

Lua basics

• Is a multi-paradigm language (supports procedural style,

functional programming, has some object-oriented

programming features)

• dynamically typed

• supports atomic data structures such as

– boolean values,

– numbers (double-precision floating point and 64-bit

integers by default),

– strings,

– tables (for arrays/sets/lists)

Page 50: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

50 29/01/2019

Lua basics

• -- means comment

• Not equal in conditionals is ~=

• Loops: while, repeat until (similar to a do while

loop), for (numeric), for (generic).

• Use i = i + 1 instead of ++ or +=

• nil for null

Page 51: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

51 29/01/2019

Lua basics

• Function example

function add(x, y)

return x + y

end

local splash = TextWindow.new(add(3,6));

Page 52: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

52 29/01/2019

Lua basics

• Function example

function add(x, y)

return x + y

end

local splash = TextWindow.new(add(3,6));

Page 53: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

53 29/01/2019

Lua basics (function example #2)

Credits: https://en.wikipedia.org/wiki/Lua_(programming_language)

Page 54: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

54 29/01/2019

Lua basics (function example #2)

Credits: https://en.wikipedia.org/wiki/Lua_(programming_language)

Page 55: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

55 29/01/2019

Editing columns example

Source: https://wiki.wireshark.org/Lua/Examples

Page 56: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

56 29/01/2019

Editing columns example (before lua)

Source: https://wiki.wireshark.org/Lua/Examples

Page 57: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

57 29/01/2019

Editing columns example (after execution)

Note: will only work at Wireshark’s start (save the script in the Plugins

folder before)

Page 58: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

58 29/01/2019

Editing trees example

Source: https://wiki.wireshark.org/LuaAPI/TreeItem

Page 59: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

59 29/01/2019

Editing trees example

Source: https://wiki.wireshark.org/LuaAPI/TreeItem

Page 60: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

60 29/01/2019

Editing trees example

Page 61: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

61 29/01/2019

Editing trees example

Page 62: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

62 29/01/2019

HTTP Example

Edit the script so that

• it works for HTTP protocol on port 80

Add a function

• e.g. addition of 2 values

• output the result in a tree field

Page 63: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

63 29/01/2019

HTTP Example

Page 64: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

64 29/01/2019

HTTP Example

Page 65: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

65 29/01/2019

Exercise

• Develop a dissector to encode the request body of a

HTTP packet into the Base64 format

(if you know how to encode it, you will probably be

able to decode it;))

Page 66: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

66 29/01/2019

Exercise

• Develop a dissector to encode the request body of a

HTTP packet into the Base64 format

(if you know how to encode it, you will probably be

able to decode it;))

Hints

https://wiki.wireshark.org/LuaAPI/TreeItem

https://github.com/toastdriven/lua-

base64/blob/master/base64.lua

Page 70: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

70 29/01/2019

Exercise (solution, proof)

• Decode as a proof

t:set_text( from_base64(to_base64(tostring(buf()))) )

Page 71: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

71 29/01/2019

Exercise (solution)

• Decode as a proof

t:set_text( from_base64(to_base64(tostring(buf()))) )

Page 72: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

72 29/01/2019

What’s next?

Page 73: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

73 29/01/2019

What’s next?

Page 74: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

74 29/01/2019

Modify/resend packets?

> use Burp, OWASP ZAP etc. proxy for

HTTP/HTTPS,

> tcpreplay, tcprewrite, tcpreplay-edit

> Canape (if you dare)

What’s next?

Page 75: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

75 29/01/2019

Questions/Feedback?

E-mail: [email protected]

Github: https://github.com/414C504F

Page 76: Wireshark Basics - OWASP · Wireshark Basics 414C504F . 29/01/2019 2 Contents •Traffic capture and traffic filtering with ... • Click on the blue shark fin button / press Ctrl

76 29/01/2019

Thanks!