SlideShare a Scribd company logo
1 of 44
Download to read offline
Fourteenforty Research Institute, Inc.
1
Fourteenforty Research Institute, Inc.
GRAPE : Generative Fuzzing
Fourteenforty Research Institute, Inc.
http://www.fourteenforty.jp
Nicholas Green
Darren Willis, Takahiko Funakubo
Fourteenforty Research Institute, Inc.
2
Grape
A Generative Fuzzer
– Inspired by Scapy , Sulley, PeachFuzz, et cetera
– Generalized Fuzzing: can fuzz packets, files, higher level
interactions
– Handles responses: can interact with stateful protocols
Fourteenforty Research Institute, Inc.
Outline
• What is fuzzing (very briefly)
– Types of fuzzing
– Challenges in fuzzing
• Our fuzzer (GRAPE)
– Overview of a fuzzing ‘scenario’
– How GRAPE specifies its rules
– How GRAPE handles complex logic (macros)
– How GRAPE handles statefulness and participates in ‘conversations’
• Demo
– Grape vs Windows 7
– Grape vs a router
3
Fourteenforty Research Institute, Inc.
Fuzzing: most basic case
4
Normal response
Normal Data
Abnormal data
No normal responseProblem found
Normal Data
System
Under
Test
Fourteenforty Research Institute, Inc.
Fuzzing (Very Much In Brief)
• Testing a system by subjecting it to malformed inputs
• Broadly, two types
– Mutating - Take existing inputs, tweak them
– Random Bit Flipping
– Field alteration (requires knowledge of fuzzed
format)
– Input samples important
– Generative - Use set of rules to create new inputs
– Also requires knowledge of fuzzed format
– Rules determine coverage
5
Fourteenforty Research Institute, Inc.
Fuzzing steps
• Find or define attack surface
• Generate Input Cases
• Feed Them To Target
• Monitor For Crashes / Unusual Behaviour
• Collect & Analyse Crash Data
6
Fourteenforty Research Institute, Inc.
Fuzzers - Generality
• Most fuzzers are quite specific
– Fuzzers for various protocols
• SNMP/DHCP/ICMP/etc
– Fuzzers for specific file formats
• PDF/HTML/SWF/etc
Scapy is an example of a more general fuzzing system, but still
network focused.
7
Fourteenforty Research Institute, Inc.
Fuzzers - Smartness
• Fuzzers vary in ‘randomness’
• Most fuzzers are smart
– Requires understanding the format of the input being
fuzzed
– Mutate/Generate input such that it’s likely to break the
system (length fields, etc)
Generally: Try to imagine how someone would have messed
up trying to implement the code parsing the input you’re
attacking.
8
Fourteenforty Research Institute, Inc.
Statefulness
• Sometimes protocols requiring keeping state
• A particular problem for generative fuzzers (mutative fuzzers
can usually playback their inputs)
• Need to incorporate responses from target into future fuzz
cases
• Examples
– Fuzzing an FTP server’s command line parsing
– Fuzzing a TCP implementation (sequence and
acknowledgement numbers)
9
Fourteenforty Research Institute, Inc.
Grape
• Generative Fuzzer
• Handles responses for stateful fuzzing
• Rules for generation written in a YAML-like dialect
• Compose rules into fuzz scenarios with Scapy-like syntax
• Pluggable backends – output can be to file, network, etc
• Sensible default low-level protocols – fuzz HTTP without
fuzzing (or thinking about) IPv4
• Heartbeat-based monitoring
• No crash data collection yet
10
Fourteenforty Research Institute, Inc.
11
Scenario
Config
Heartbeat
Fuzzing
Group
Group
Fourteenforty Research Institute, Inc.
12
Scenario
Config
Heartbeat
Fuzzing
Group
Group
Configuration for this
scenario.
E.g. setting a path and
low layer.
Example:
config {
rule_path: http/
low_layer: ether/ipv4/tcp
}
Fourteenforty Research Institute, Inc.
13
Scenario
Config
Heartbeat
Fuzzing
Group
Group
Monitor the target with a
“heartbeat”
Example:
heart_beat {
group {
send: http_head
recv: recv_http_head
}
}
Fourteenforty Research Institute, Inc.
14
Scenario
Config
Heartbeat
Fuzzing
Group
Group
The “fuzzing” category
describes a set of
“groups” which control the
real fuzzing
fuzzing {
group {
…
}
group {
…
}
}
Fourteenforty Research Institute, Inc.
15
Scenario
Config
Heartbeat
Fuzzing
Group
Group
A group describes a
“conversation” or series
of generations.
Example:
group {
send: http_init
recv: recv_basic
send: tricky_stuff
}
Fourteenforty Research Institute, Inc.
16
Group
Packet Description
A packet description is
one “send” or “receive”
line from the groups:
Example:
send: http_init
Rule
Rule
Packet Description
Rule
Rule
Fourteenforty Research Institute, Inc.
17
Group
Packet Description
A rule describes how an actual
input or series of inputs is created
(this is the generative bit!):
Example:
mostly_harmless:
method/s: ["GET", "PUT"]
space/s: " "
path/s: ["/index.html", "/“]
http/s: " HTTP/1.1¥r¥n"
done/s: "¥r¥n"
Rule
Rule
Packet Description
Rule
Rule
Fourteenforty Research Institute, Inc.
Simple Interactions
send: send this to (network/ a file)
recv: Receive this response (network only for now)
recv rules match the incoming data with certain rules
–If no match, skips to next fuzzing fuzzing case
Note: no ‘real’ flow control
–Use several groups, instead
18
Fourteenforty Research Institute, Inc.
Packet Structure Description
Here’s where we took inspiration from Scapy
There’s ‘layers’
ether/ipv4/tcp(syn:1)/payload(data:”AAAAA”)
‘/’ separates layers, parentheses allow overwriting of named
values inside the ‘rules’
‘sublayers’ can be placed in parentheses
ether/ipv6(routing(type:0))/udp/random(50)
19
Fourteenforty Research Institute, Inc.
Rule Definitions
The structures of generated inputs are composed
from ‘rules’ These rules are defined in separate files.
YAML-inspired syntax, but not really YAML
A Rule:
gif_basic:
signature/s3 : "GIF"
version/s3 : ["89a","87a"]
logical_screen_width/I2 : 32
logical_screen_height/I2 : 52
global_color_table_flag/b1 : 1
color_resolution/b3 : 7
20
Fourteenforty Research Institute, Inc.
Primitive Definitions II
Primitives are given by name, followed with a type and a length,
and then possible values for that primitive to take.
These values are automatically used in fuzzing.
Type is one of:
I: Big Endian Integer (that’s a capital i)
i: Little Endian Integer
S: Symbol
s: String
B: Binary
b: Bitfield
Lengths are in bytes, except for bitfields, where they are in
bits.
21
version/s3: ["89a","87a"]
Fourteenforty Research Institute, Inc.
Rule Definitions
The structures of generated inputs are composed
from ‘rules’ These rules are defined in separate files.
YAML-inspired syntax, but not really YAML
A Rule:
gif_basic:
signature/s3 : "GIF"
version/s3 : ["89a","87a"]
logical_screen_width/I2 : 32
logical_screen_height/I2 : 52
global_color_table_flag/b1 : 1
color_resolution/b3 : 7
22
Fourteenforty Research Institute, Inc.
Fuzzing Combinations
Fields like version/s3: ["89a","87a"] with multiple values
are automatically fuzzed by the fuzzing engine.
Output is generated such that every value given for a field is
present at least once in the output. One field per output is
‘fuzzed’; that field is iterated over. All others take their leftmost
value.
Fuzzing is not combinatorial, however:
version/s3: [“A",“B"]
width/I2: [1, 2, 3]
produces 4 combinations:
(“A”, 1) (“B”,1) (“A”, 2) (“A”, 3)
23
Fourteenforty Research Institute, Inc.
Combinatorial fuzzing
• We can also have fields that we want to fuzz as a
“combination”. i.e. This Rule:
24
CombinationMultiFieldFuzz:
value1%combo1/s1: [“A” , “B”]
value2%combo1/I1: [1, 2, 3]
Produces the following 6 combinations:
(“A”, 1) (“B”,1) (“A”, 2) (“B”, 2”) (“A”, 3) (“B”, 3)
Fourteenforty Research Institute, Inc.
Response Definitions
Responses are matched against response rules. These are similar
to the generation rules. Specifying a value indicates that part of
the response should match that value.
_ is “Don’t care”, and matches anything
Can also capture values using $() syntax:
recv_tcp:
src/i2 : _
dest/i2 : _
seqno/I4: $(sequence_number)
Captured values are available as variables.
25
Fourteenforty Research Institute, Inc.
Response Definitions II - Regexes
Response Definitions can include simplified regexps for string
matching
HTTP:
response: [“%s %d %s¥r¥n”, $(version), $(code),
$(status)”]
These are powered by Oniguruma; the results of the scanf –style
capture directives get saved to corresponding variables.’
Real regexes can also be used for more power (i.e. non-scanf-
style).
26
Fourteenforty Research Institute, Inc.
Response Definitions III
Primitives in responses can be marked with an asterisk ‘*’ to
indicate 0 or more of the primitive should be matched.
Useful for matching higher-level patterns:
HTTP:
header-line/s*: “%s¥r¥n”
cache-expires/s: “EXPIRES blah blah ¥r¥n”
header-line/s*: “%s¥r¥n”
done/s: “¥r¥n”
This matches an expires line at any point in the header
27
Fourteenforty Research Institute, Inc.
Variables
tcp:
srcport/I2: 0
dstport/I2: $tcp_dst_port
…
The syntax ‘$tcp_dst_port ‘ inserts the value of a variable
named ‘tcp_dst_port’.
Variables can be set by the user initially, captured from incoming
packets, or calculated by macro statements.
28
Fourteenforty Research Institute, Inc.
Symbols
• Symbols go inside <angle_brackets>
• Similar to variables but for internal use within the rules.
• Get substituted like rules
fuzzable_thing:
type%comb/i1 : [0,1,2,3, 256]
length%comb/i1 : [1,127, 128, 255, 256, 32767, 32768, 65535, 65536]
data%/comb/B : $repeat(<padding>, ($ivalue(<length>) + 1) / 2)
padding:
data1%comb/I1 : [0,1,2,3,4]
data2%comb/I1 : [0,1,2,3,4]
29
Fourteenforty Research Institute, Inc.
Macros
ipv4[6]:
version/b4 : 4
header_length/b4 : [($ilength(<ipv4>) -$ilength(<payload>)) / 4, 0, 15]
dscp_or_tos/S : [ <tos>, <dscp> ]
packet_length/I2 : [$ilength(<ipv4>), 1, 16, 32]
Various macros are provided, e.g. $ilength(<symbol>)
Arithmetic permitted – header_length can be the length of the
whole ipv4 block, minus the length of the payload block, divided
by 4.
Other macros include $tcp_checksum, $md5, $repeatA
30
Fourteenforty Research Institute, Inc.
Macro Example
void Macros::macro_irandom(Field *f, Var &out,
int argc, Var *argv)
{
int ret = rand();
out.setInteger(ret);
}
The macro interface is still work-in-progress.
Var types hold values used during generation; the result of a
macro can be set by calling ‘setInteger’, ‘setString’, etc, on
the ‘out’ argument of the macro.
argv is an array of argc pointers to Vars.
31
Fourteenforty Research Institute, Inc.
Backends
How the generated data is actually used.
Currently Provided:
Raw-Ethernet IPv4 IPv6 UDP TCP HTTP File
Lower level network backends use raw sockets and libpcap
Higher level network backends use OS provided sockets
32
Fourteenforty Research Institute, Inc.
Multiple Backends
Backends can be named
command: ether/ipv4/tcp
data: ether/ipv4/tcp(tcp_dst_port: 20)
Packets can be sent to any named backend
send(command): ftp/login(uname: ”foo”, pword: “bar”)
send(data): ftp/payload(data: “hogehogehoge”)
Sent to default(first) backend if no name specified.
Connection-based backends automatically opened on first send
33
Fourteenforty Research Institute, Inc.
Monitoring
• Currently an optional ‘heartbeat’ can be defined
• Detects when the target stops responding
• Usually, ICMP or ICMPv6 Echo Requests (pings)
• Can specify heartbeat interval (once every n packets)
34
Fourteenforty Research Institute, Inc.
HeartBeat
heart_beat {
group {
send: ipv4/icmp(icmp_echo_req)
recv: recv_ipv4/recv_icmp(recv_icmp_echo)
}
}
The monitoring heartbeat is specified like any other fuzzing rule.
Heartbeat can have a different backend.
35
Fourteenforty Research Institute, Inc.
Example – IPv6 Fuzzing
ipv6:
version/b4 : 6
trafficclass/b8 : 0
flowlabel/b20 : 0
packet_length/I2: $ilength(<payload>) + $ilength(<headers>)
next_header/I1 : $id(<next>)
hoplimit/I1 : [127, 255, 0]
src_address/B16 : $ipv6_addr($ipv6_src)
dest_address/B16 : $ipv6_addr($ipv6_dst)
headers/S : <next_sublayer>
payload/S : <next_layer>
Generates an IPv6 header, and continues into the extension headers.
36
Fourteenforty Research Institute, Inc.
IPv6 Fuzzing - contd
For IPv6, instead of fuzzing values we fuzz structures -
Various combinations of chains of extension headers and
associated options:
send: ipv6(hopbyhop(home_address/quick_start)/routing/esp)/tcp
send: ipv6(hopbyhop(home_address/endpoint_ID)/routing/esp)/tcp
send: ipv6(hopbyhop(home_address/tunnel_limit)/routing/esp)/tcp
send: ipv6(hopbyhop(home_address/router_alert)/routing/esp)/tcp
Of course, these are generated by a script.
37
Fourteenforty Research Institute, Inc.
Example: TCP Fuzzing
tcp[0x6]:
srcport/I2: 0
dest/I2: $tcp_dst_port
seqno/I4: 0
ackno/I4: 0
dataoff/b4: ($ilength($<opts>) / 4) + 5
reserved/b4: 0
cwr/b1: 0
ece/b1: 0
urg/b1: 0
ack/b1: 0
… etc.
TCP control bits can be set using overwrites in the scenario file.
38
Fourteenforty Research Institute, Inc.
TCP Scenario Excerpt
group{
send: tcp(seqno:1747422, srcport: 6295, syn: 1, cwr:1, ece:1)
recv: recv_tcp
send: tcp(seqno:$recv_ack, srcport: 6295, ack: 1, ackno: $recv_seq + 1 ,
cwr:1, ece:1)
recv: recv_tcp
send: tcp(seqno:1747423, srcport: 6295,cwr:1, ece:1)/tcp_payload
recv: recv_tcp
send: tcp(seqno:1747449, srcport: 6295,fin: 1, cwr:1, ece:1)/tcp_payload
}
Scenario file uses overwrites to control the higher-level
behaviour to comply with the TCP protocol.
39
Fourteenforty Research Institute, Inc.
Demo One – IPv6
• Quick ipv6 fuzzing demo against Windows 7
40
Fourteenforty Research Institute, Inc.
Demo Two: Router(a)
• DoS
41
Fourteenforty Research Institute, Inc.
Limitations
• Speed
– Research quality code
• Expressiveness
– Flow Control in scenarios
Small set of backends at present
42
Fourteenforty Research Institute, Inc.
Future Work
• Speediness
• Flow Control
• More Backends
• Macro programming for everyone
– Scripting language
• More sophisticated monitoring
– Likely requires cooperation with vendors for embedded
devices
– Develop a protocol?
• More file-oriented fuzzing support (spawning processes to
open generated files, etc)
43
Fourteenforty Research Institute, Inc.
44
Thank you!
Questions?
Fourteenforty Research Institute, Inc.
http://www.fourteenforty.jp
Nicholas Green
green@fourteenforty.jp

More Related Content

What's hot

Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary dataKernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Anne Nicolas
 
Clonewise - Automatically Detecting Package Clones and Inferring Security Vu...
Clonewise  - Automatically Detecting Package Clones and Inferring Security Vu...Clonewise  - Automatically Detecting Package Clones and Inferring Security Vu...
Clonewise - Automatically Detecting Package Clones and Inferring Security Vu...
Silvio Cesare
 
Write Your Own JVM Compiler
Write Your Own JVM CompilerWrite Your Own JVM Compiler
Write Your Own JVM Compiler
Erin Dees
 

What's hot (20)

Python Presentation
Python PresentationPython Presentation
Python Presentation
 
Python Foundation – A programmer's introduction to Python concepts & style
Python Foundation – A programmer's introduction to Python concepts & stylePython Foundation – A programmer's introduction to Python concepts & style
Python Foundation – A programmer's introduction to Python concepts & style
 
Rbootcamp Day 5
Rbootcamp Day 5Rbootcamp Day 5
Rbootcamp Day 5
 
Introduction to Python Pandas for Data Analytics
Introduction to Python Pandas for Data AnalyticsIntroduction to Python Pandas for Data Analytics
Introduction to Python Pandas for Data Analytics
 
Your Own Metric System
Your Own Metric SystemYour Own Metric System
Your Own Metric System
 
Python Interview Questions And Answers
Python Interview Questions And AnswersPython Interview Questions And Answers
Python Interview Questions And Answers
 
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary dataKernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
 
Python Intro-Functions
Python Intro-FunctionsPython Intro-Functions
Python Intro-Functions
 
Franta Polach - Exploring Patent Data with Python
Franta Polach - Exploring Patent Data with PythonFranta Polach - Exploring Patent Data with Python
Franta Polach - Exploring Patent Data with Python
 
Thnad's Revenge
Thnad's RevengeThnad's Revenge
Thnad's Revenge
 
SnortUsersWebcast-Rules_pt2
SnortUsersWebcast-Rules_pt2SnortUsersWebcast-Rules_pt2
SnortUsersWebcast-Rules_pt2
 
HackIM 2012 CTF Walkthrough
HackIM 2012 CTF WalkthroughHackIM 2012 CTF Walkthrough
HackIM 2012 CTF Walkthrough
 
Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answers
 
PyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 TutorialPyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 Tutorial
 
The Benefits of Type Hints
The Benefits of Type HintsThe Benefits of Type Hints
The Benefits of Type Hints
 
JRuby, Not Just For Hard-Headed Pragmatists Anymore
JRuby, Not Just For Hard-Headed Pragmatists AnymoreJRuby, Not Just For Hard-Headed Pragmatists Anymore
JRuby, Not Just For Hard-Headed Pragmatists Anymore
 
Python for Penetration testers
Python for Penetration testersPython for Penetration testers
Python for Penetration testers
 
Clonewise - Automatically Detecting Package Clones and Inferring Security Vu...
Clonewise  - Automatically Detecting Package Clones and Inferring Security Vu...Clonewise  - Automatically Detecting Package Clones and Inferring Security Vu...
Clonewise - Automatically Detecting Package Clones and Inferring Security Vu...
 
Python for Linux System Administration
Python for Linux System AdministrationPython for Linux System Administration
Python for Linux System Administration
 
Write Your Own JVM Compiler
Write Your Own JVM CompilerWrite Your Own JVM Compiler
Write Your Own JVM Compiler
 

Viewers also liked

Viewers also liked (7)

STRIDE Variants and Security Requirements-based Threat Analysis (FFRI Monthly...
STRIDE Variants and Security Requirements-based Threat Analysis (FFRI Monthly...STRIDE Variants and Security Requirements-based Threat Analysis (FFRI Monthly...
STRIDE Variants and Security Requirements-based Threat Analysis (FFRI Monthly...
 
Introduction of Threat Analysis Methods(FFRI Monthly Research 2016.9)
Introduction of Threat Analysis Methods(FFRI Monthly Research 2016.9)Introduction of Threat Analysis Methods(FFRI Monthly Research 2016.9)
Introduction of Threat Analysis Methods(FFRI Monthly Research 2016.9)
 
Black Hat USA 2016 Survey Report (FFRI Monthly Research 2016.8)
Black Hat USA 2016  Survey Report (FFRI Monthly Research 2016.8)Black Hat USA 2016  Survey Report (FFRI Monthly Research 2016.8)
Black Hat USA 2016 Survey Report (FFRI Monthly Research 2016.8)
 
An Example of use the Threat Modeling Tool (FFRI Monthly Research Nov 2016)
An Example of use the Threat Modeling Tool (FFRI Monthly Research Nov 2016)An Example of use the Threat Modeling Tool (FFRI Monthly Research Nov 2016)
An Example of use the Threat Modeling Tool (FFRI Monthly Research Nov 2016)
 
Мониторинг своими руками
Мониторинг своими рукамиМониторинг своими руками
Мониторинг своими руками
 
20% of investment and 80% of profit. How to implement security requirements a...
20% of investment and 80% of profit. How to implement security requirements a...20% of investment and 80% of profit. How to implement security requirements a...
20% of investment and 80% of profit. How to implement security requirements a...
 
A Threat Hunter Himself
A Threat Hunter HimselfA Threat Hunter Himself
A Threat Hunter Himself
 

Similar to Grape generative fuzzing

Advanced Sockets Programming
Advanced Sockets ProgrammingAdvanced Sockets Programming
Advanced Sockets Programming
elliando dias
 

Similar to Grape generative fuzzing (20)

Who pulls the strings?
Who pulls the strings?Who pulls the strings?
Who pulls the strings?
 
ch01-basic-java-programs.ppt
ch01-basic-java-programs.pptch01-basic-java-programs.ppt
ch01-basic-java-programs.ppt
 
Fuzzing: The New Unit Testing
Fuzzing: The New Unit TestingFuzzing: The New Unit Testing
Fuzzing: The New Unit Testing
 
Writing and using php streams and sockets tek11
Writing and using php streams and sockets   tek11Writing and using php streams and sockets   tek11
Writing and using php streams and sockets tek11
 
BioMake BOSC 2004
BioMake BOSC 2004BioMake BOSC 2004
BioMake BOSC 2004
 
Streams, sockets and filters oh my!
Streams, sockets and filters oh my!Streams, sockets and filters oh my!
Streams, sockets and filters oh my!
 
Hadoop: Code Injection, Distributed Fault Injection
Hadoop: Code Injection, Distributed Fault InjectionHadoop: Code Injection, Distributed Fault Injection
Hadoop: Code Injection, Distributed Fault Injection
 
Fletcher Framework for Programming FPGA
Fletcher Framework for Programming FPGAFletcher Framework for Programming FPGA
Fletcher Framework for Programming FPGA
 
Automatic test packet generation
Automatic test packet generationAutomatic test packet generation
Automatic test packet generation
 
Ch01 basic-java-programs
Ch01 basic-java-programsCh01 basic-java-programs
Ch01 basic-java-programs
 
BSides IR in Heterogeneous Environment
BSides IR in Heterogeneous EnvironmentBSides IR in Heterogeneous Environment
BSides IR in Heterogeneous Environment
 
Fuzzing - Part 1
Fuzzing - Part 1Fuzzing - Part 1
Fuzzing - Part 1
 
Regex Considered Harmful: Use Rosie Pattern Language Instead
Regex Considered Harmful: Use Rosie Pattern Language InsteadRegex Considered Harmful: Use Rosie Pattern Language Instead
Regex Considered Harmful: Use Rosie Pattern Language Instead
 
A Java Implementer's Guide to Better Apache Spark Performance
A Java Implementer's Guide to Better Apache Spark PerformanceA Java Implementer's Guide to Better Apache Spark Performance
A Java Implementer's Guide to Better Apache Spark Performance
 
Symbolic Execution And KLEE
Symbolic Execution And KLEESymbolic Execution And KLEE
Symbolic Execution And KLEE
 
Advanced Sockets Programming
Advanced Sockets ProgrammingAdvanced Sockets Programming
Advanced Sockets Programming
 
Process management
Process managementProcess management
Process management
 
Slide cipher based encryption
Slide cipher based encryptionSlide cipher based encryption
Slide cipher based encryption
 
StormCrawler at Bristech
StormCrawler at BristechStormCrawler at Bristech
StormCrawler at Bristech
 
Splunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the messageSplunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the message
 

More from FFRI, Inc.

Appearances are deceiving: Novel offensive techniques in Windows 10/11 on ARM
Appearances are deceiving: Novel offensive techniques in Windows 10/11 on ARMAppearances are deceiving: Novel offensive techniques in Windows 10/11 on ARM
Appearances are deceiving: Novel offensive techniques in Windows 10/11 on ARM
FFRI, Inc.
 
Appearances are deceiving: Novel offensive techniques in Windows 10/11 on ARM
Appearances are deceiving: Novel offensive techniques in Windows 10/11 on ARMAppearances are deceiving: Novel offensive techniques in Windows 10/11 on ARM
Appearances are deceiving: Novel offensive techniques in Windows 10/11 on ARM
FFRI, Inc.
 
Malwarem armed with PowerShell
Malwarem armed with PowerShellMalwarem armed with PowerShell
Malwarem armed with PowerShell
FFRI, Inc.
 
MR201501 Latest trends in Linux Malware
MR201501 Latest trends in Linux MalwareMR201501 Latest trends in Linux Malware
MR201501 Latest trends in Linux Malware
FFRI, Inc.
 

More from FFRI, Inc. (20)

Appearances are deceiving: Novel offensive techniques in Windows 10/11 on ARM
Appearances are deceiving: Novel offensive techniques in Windows 10/11 on ARMAppearances are deceiving: Novel offensive techniques in Windows 10/11 on ARM
Appearances are deceiving: Novel offensive techniques in Windows 10/11 on ARM
 
Appearances are deceiving: Novel offensive techniques in Windows 10/11 on ARM
Appearances are deceiving: Novel offensive techniques in Windows 10/11 on ARMAppearances are deceiving: Novel offensive techniques in Windows 10/11 on ARM
Appearances are deceiving: Novel offensive techniques in Windows 10/11 on ARM
 
TrustZone use case and trend (FFRI Monthly Research Mar 2017)
TrustZone use case and trend (FFRI Monthly Research Mar 2017) TrustZone use case and trend (FFRI Monthly Research Mar 2017)
TrustZone use case and trend (FFRI Monthly Research Mar 2017)
 
Android Things Security Research in Developer Preview 2 (FFRI Monthly Researc...
Android Things Security Research in Developer Preview 2 (FFRI Monthly Researc...Android Things Security Research in Developer Preview 2 (FFRI Monthly Researc...
Android Things Security Research in Developer Preview 2 (FFRI Monthly Researc...
 
An Overview of the Android Things Security (FFRI Monthly Research Jan 2017)
An Overview of the Android Things Security (FFRI Monthly Research Jan 2017) An Overview of the Android Things Security (FFRI Monthly Research Jan 2017)
An Overview of the Android Things Security (FFRI Monthly Research Jan 2017)
 
Black Hat Europe 2016 Survey Report (FFRI Monthly Research Dec 2016)
Black Hat Europe 2016 Survey Report (FFRI Monthly Research Dec 2016) Black Hat Europe 2016 Survey Report (FFRI Monthly Research Dec 2016)
Black Hat Europe 2016 Survey Report (FFRI Monthly Research Dec 2016)
 
About security assessment framework “CHIPSEC” (FFRI Monthly Research 2016.7)
About security assessment framework “CHIPSEC” (FFRI Monthly Research 2016.7) About security assessment framework “CHIPSEC” (FFRI Monthly Research 2016.7)
About security assessment framework “CHIPSEC” (FFRI Monthly Research 2016.7)
 
Black Hat USA 2016 Pre-Survey (FFRI Monthly Research 2016.6)
Black Hat USA 2016 Pre-Survey (FFRI Monthly Research 2016.6)Black Hat USA 2016 Pre-Survey (FFRI Monthly Research 2016.6)
Black Hat USA 2016 Pre-Survey (FFRI Monthly Research 2016.6)
 
Black Hat Asia 2016 Survey Report (FFRI Monthly Research 2016.4)
Black Hat Asia 2016 Survey Report (FFRI Monthly Research 2016.4)Black Hat Asia 2016 Survey Report (FFRI Monthly Research 2016.4)
Black Hat Asia 2016 Survey Report (FFRI Monthly Research 2016.4)
 
ARMv8-M TrustZone: A New Security Feature for Embedded Systems (FFRI Monthly ...
ARMv8-M TrustZone: A New Security Feature for Embedded Systems (FFRI Monthly ...ARMv8-M TrustZone: A New Security Feature for Embedded Systems (FFRI Monthly ...
ARMv8-M TrustZone: A New Security Feature for Embedded Systems (FFRI Monthly ...
 
CODE BLUE 2015 Report (FFRI Monthly Research 2015.11)
CODE BLUE 2015 Report (FFRI Monthly Research 2015.11)CODE BLUE 2015 Report (FFRI Monthly Research 2015.11)
CODE BLUE 2015 Report (FFRI Monthly Research 2015.11)
 
Latest Security Reports of Automobile and Vulnerability Assessment by CVSS v3...
Latest Security Reports of Automobile and Vulnerability Assessment by CVSS v3...Latest Security Reports of Automobile and Vulnerability Assessment by CVSS v3...
Latest Security Reports of Automobile and Vulnerability Assessment by CVSS v3...
 
Black Hat USA 2015 Survey Report (FFRI Monthly Research 201508)
Black Hat USA 2015 Survey Report (FFRI Monthly Research 201508)Black Hat USA 2015 Survey Report (FFRI Monthly Research 201508)
Black Hat USA 2015 Survey Report (FFRI Monthly Research 201508)
 
A Survey of Threats in OS X and iOS(FFRI Monthly Research 201507)
A Survey of Threats in OS X and iOS(FFRI Monthly Research 201507)A Survey of Threats in OS X and iOS(FFRI Monthly Research 201507)
A Survey of Threats in OS X and iOS(FFRI Monthly Research 201507)
 
Security of Windows 10 IoT Core(FFRI Monthly Research 201506)
Security of Windows 10 IoT Core(FFRI Monthly Research 201506)Security of Windows 10 IoT Core(FFRI Monthly Research 201506)
Security of Windows 10 IoT Core(FFRI Monthly Research 201506)
 
Trend of Next-Gen In-Vehicle Network Standard and Current State of Security(F...
Trend of Next-Gen In-Vehicle Network Standard and Current State of Security(F...Trend of Next-Gen In-Vehicle Network Standard and Current State of Security(F...
Trend of Next-Gen In-Vehicle Network Standard and Current State of Security(F...
 
Malwarem armed with PowerShell
Malwarem armed with PowerShellMalwarem armed with PowerShell
Malwarem armed with PowerShell
 
MR201504 Web Defacing Attacks Targeting WordPress
MR201504 Web Defacing Attacks Targeting WordPressMR201504 Web Defacing Attacks Targeting WordPress
MR201504 Web Defacing Attacks Targeting WordPress
 
MR201502 Intel Memory Protection Extensions Overview
MR201502 Intel Memory Protection Extensions OverviewMR201502 Intel Memory Protection Extensions Overview
MR201502 Intel Memory Protection Extensions Overview
 
MR201501 Latest trends in Linux Malware
MR201501 Latest trends in Linux MalwareMR201501 Latest trends in Linux Malware
MR201501 Latest trends in Linux Malware
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Grape generative fuzzing

  • 1. Fourteenforty Research Institute, Inc. 1 Fourteenforty Research Institute, Inc. GRAPE : Generative Fuzzing Fourteenforty Research Institute, Inc. http://www.fourteenforty.jp Nicholas Green Darren Willis, Takahiko Funakubo
  • 2. Fourteenforty Research Institute, Inc. 2 Grape A Generative Fuzzer – Inspired by Scapy , Sulley, PeachFuzz, et cetera – Generalized Fuzzing: can fuzz packets, files, higher level interactions – Handles responses: can interact with stateful protocols
  • 3. Fourteenforty Research Institute, Inc. Outline • What is fuzzing (very briefly) – Types of fuzzing – Challenges in fuzzing • Our fuzzer (GRAPE) – Overview of a fuzzing ‘scenario’ – How GRAPE specifies its rules – How GRAPE handles complex logic (macros) – How GRAPE handles statefulness and participates in ‘conversations’ • Demo – Grape vs Windows 7 – Grape vs a router 3
  • 4. Fourteenforty Research Institute, Inc. Fuzzing: most basic case 4 Normal response Normal Data Abnormal data No normal responseProblem found Normal Data System Under Test
  • 5. Fourteenforty Research Institute, Inc. Fuzzing (Very Much In Brief) • Testing a system by subjecting it to malformed inputs • Broadly, two types – Mutating - Take existing inputs, tweak them – Random Bit Flipping – Field alteration (requires knowledge of fuzzed format) – Input samples important – Generative - Use set of rules to create new inputs – Also requires knowledge of fuzzed format – Rules determine coverage 5
  • 6. Fourteenforty Research Institute, Inc. Fuzzing steps • Find or define attack surface • Generate Input Cases • Feed Them To Target • Monitor For Crashes / Unusual Behaviour • Collect & Analyse Crash Data 6
  • 7. Fourteenforty Research Institute, Inc. Fuzzers - Generality • Most fuzzers are quite specific – Fuzzers for various protocols • SNMP/DHCP/ICMP/etc – Fuzzers for specific file formats • PDF/HTML/SWF/etc Scapy is an example of a more general fuzzing system, but still network focused. 7
  • 8. Fourteenforty Research Institute, Inc. Fuzzers - Smartness • Fuzzers vary in ‘randomness’ • Most fuzzers are smart – Requires understanding the format of the input being fuzzed – Mutate/Generate input such that it’s likely to break the system (length fields, etc) Generally: Try to imagine how someone would have messed up trying to implement the code parsing the input you’re attacking. 8
  • 9. Fourteenforty Research Institute, Inc. Statefulness • Sometimes protocols requiring keeping state • A particular problem for generative fuzzers (mutative fuzzers can usually playback their inputs) • Need to incorporate responses from target into future fuzz cases • Examples – Fuzzing an FTP server’s command line parsing – Fuzzing a TCP implementation (sequence and acknowledgement numbers) 9
  • 10. Fourteenforty Research Institute, Inc. Grape • Generative Fuzzer • Handles responses for stateful fuzzing • Rules for generation written in a YAML-like dialect • Compose rules into fuzz scenarios with Scapy-like syntax • Pluggable backends – output can be to file, network, etc • Sensible default low-level protocols – fuzz HTTP without fuzzing (or thinking about) IPv4 • Heartbeat-based monitoring • No crash data collection yet 10
  • 11. Fourteenforty Research Institute, Inc. 11 Scenario Config Heartbeat Fuzzing Group Group
  • 12. Fourteenforty Research Institute, Inc. 12 Scenario Config Heartbeat Fuzzing Group Group Configuration for this scenario. E.g. setting a path and low layer. Example: config { rule_path: http/ low_layer: ether/ipv4/tcp }
  • 13. Fourteenforty Research Institute, Inc. 13 Scenario Config Heartbeat Fuzzing Group Group Monitor the target with a “heartbeat” Example: heart_beat { group { send: http_head recv: recv_http_head } }
  • 14. Fourteenforty Research Institute, Inc. 14 Scenario Config Heartbeat Fuzzing Group Group The “fuzzing” category describes a set of “groups” which control the real fuzzing fuzzing { group { … } group { … } }
  • 15. Fourteenforty Research Institute, Inc. 15 Scenario Config Heartbeat Fuzzing Group Group A group describes a “conversation” or series of generations. Example: group { send: http_init recv: recv_basic send: tricky_stuff }
  • 16. Fourteenforty Research Institute, Inc. 16 Group Packet Description A packet description is one “send” or “receive” line from the groups: Example: send: http_init Rule Rule Packet Description Rule Rule
  • 17. Fourteenforty Research Institute, Inc. 17 Group Packet Description A rule describes how an actual input or series of inputs is created (this is the generative bit!): Example: mostly_harmless: method/s: ["GET", "PUT"] space/s: " " path/s: ["/index.html", "/“] http/s: " HTTP/1.1¥r¥n" done/s: "¥r¥n" Rule Rule Packet Description Rule Rule
  • 18. Fourteenforty Research Institute, Inc. Simple Interactions send: send this to (network/ a file) recv: Receive this response (network only for now) recv rules match the incoming data with certain rules –If no match, skips to next fuzzing fuzzing case Note: no ‘real’ flow control –Use several groups, instead 18
  • 19. Fourteenforty Research Institute, Inc. Packet Structure Description Here’s where we took inspiration from Scapy There’s ‘layers’ ether/ipv4/tcp(syn:1)/payload(data:”AAAAA”) ‘/’ separates layers, parentheses allow overwriting of named values inside the ‘rules’ ‘sublayers’ can be placed in parentheses ether/ipv6(routing(type:0))/udp/random(50) 19
  • 20. Fourteenforty Research Institute, Inc. Rule Definitions The structures of generated inputs are composed from ‘rules’ These rules are defined in separate files. YAML-inspired syntax, but not really YAML A Rule: gif_basic: signature/s3 : "GIF" version/s3 : ["89a","87a"] logical_screen_width/I2 : 32 logical_screen_height/I2 : 52 global_color_table_flag/b1 : 1 color_resolution/b3 : 7 20
  • 21. Fourteenforty Research Institute, Inc. Primitive Definitions II Primitives are given by name, followed with a type and a length, and then possible values for that primitive to take. These values are automatically used in fuzzing. Type is one of: I: Big Endian Integer (that’s a capital i) i: Little Endian Integer S: Symbol s: String B: Binary b: Bitfield Lengths are in bytes, except for bitfields, where they are in bits. 21 version/s3: ["89a","87a"]
  • 22. Fourteenforty Research Institute, Inc. Rule Definitions The structures of generated inputs are composed from ‘rules’ These rules are defined in separate files. YAML-inspired syntax, but not really YAML A Rule: gif_basic: signature/s3 : "GIF" version/s3 : ["89a","87a"] logical_screen_width/I2 : 32 logical_screen_height/I2 : 52 global_color_table_flag/b1 : 1 color_resolution/b3 : 7 22
  • 23. Fourteenforty Research Institute, Inc. Fuzzing Combinations Fields like version/s3: ["89a","87a"] with multiple values are automatically fuzzed by the fuzzing engine. Output is generated such that every value given for a field is present at least once in the output. One field per output is ‘fuzzed’; that field is iterated over. All others take their leftmost value. Fuzzing is not combinatorial, however: version/s3: [“A",“B"] width/I2: [1, 2, 3] produces 4 combinations: (“A”, 1) (“B”,1) (“A”, 2) (“A”, 3) 23
  • 24. Fourteenforty Research Institute, Inc. Combinatorial fuzzing • We can also have fields that we want to fuzz as a “combination”. i.e. This Rule: 24 CombinationMultiFieldFuzz: value1%combo1/s1: [“A” , “B”] value2%combo1/I1: [1, 2, 3] Produces the following 6 combinations: (“A”, 1) (“B”,1) (“A”, 2) (“B”, 2”) (“A”, 3) (“B”, 3)
  • 25. Fourteenforty Research Institute, Inc. Response Definitions Responses are matched against response rules. These are similar to the generation rules. Specifying a value indicates that part of the response should match that value. _ is “Don’t care”, and matches anything Can also capture values using $() syntax: recv_tcp: src/i2 : _ dest/i2 : _ seqno/I4: $(sequence_number) Captured values are available as variables. 25
  • 26. Fourteenforty Research Institute, Inc. Response Definitions II - Regexes Response Definitions can include simplified regexps for string matching HTTP: response: [“%s %d %s¥r¥n”, $(version), $(code), $(status)”] These are powered by Oniguruma; the results of the scanf –style capture directives get saved to corresponding variables.’ Real regexes can also be used for more power (i.e. non-scanf- style). 26
  • 27. Fourteenforty Research Institute, Inc. Response Definitions III Primitives in responses can be marked with an asterisk ‘*’ to indicate 0 or more of the primitive should be matched. Useful for matching higher-level patterns: HTTP: header-line/s*: “%s¥r¥n” cache-expires/s: “EXPIRES blah blah ¥r¥n” header-line/s*: “%s¥r¥n” done/s: “¥r¥n” This matches an expires line at any point in the header 27
  • 28. Fourteenforty Research Institute, Inc. Variables tcp: srcport/I2: 0 dstport/I2: $tcp_dst_port … The syntax ‘$tcp_dst_port ‘ inserts the value of a variable named ‘tcp_dst_port’. Variables can be set by the user initially, captured from incoming packets, or calculated by macro statements. 28
  • 29. Fourteenforty Research Institute, Inc. Symbols • Symbols go inside <angle_brackets> • Similar to variables but for internal use within the rules. • Get substituted like rules fuzzable_thing: type%comb/i1 : [0,1,2,3, 256] length%comb/i1 : [1,127, 128, 255, 256, 32767, 32768, 65535, 65536] data%/comb/B : $repeat(<padding>, ($ivalue(<length>) + 1) / 2) padding: data1%comb/I1 : [0,1,2,3,4] data2%comb/I1 : [0,1,2,3,4] 29
  • 30. Fourteenforty Research Institute, Inc. Macros ipv4[6]: version/b4 : 4 header_length/b4 : [($ilength(<ipv4>) -$ilength(<payload>)) / 4, 0, 15] dscp_or_tos/S : [ <tos>, <dscp> ] packet_length/I2 : [$ilength(<ipv4>), 1, 16, 32] Various macros are provided, e.g. $ilength(<symbol>) Arithmetic permitted – header_length can be the length of the whole ipv4 block, minus the length of the payload block, divided by 4. Other macros include $tcp_checksum, $md5, $repeatA 30
  • 31. Fourteenforty Research Institute, Inc. Macro Example void Macros::macro_irandom(Field *f, Var &out, int argc, Var *argv) { int ret = rand(); out.setInteger(ret); } The macro interface is still work-in-progress. Var types hold values used during generation; the result of a macro can be set by calling ‘setInteger’, ‘setString’, etc, on the ‘out’ argument of the macro. argv is an array of argc pointers to Vars. 31
  • 32. Fourteenforty Research Institute, Inc. Backends How the generated data is actually used. Currently Provided: Raw-Ethernet IPv4 IPv6 UDP TCP HTTP File Lower level network backends use raw sockets and libpcap Higher level network backends use OS provided sockets 32
  • 33. Fourteenforty Research Institute, Inc. Multiple Backends Backends can be named command: ether/ipv4/tcp data: ether/ipv4/tcp(tcp_dst_port: 20) Packets can be sent to any named backend send(command): ftp/login(uname: ”foo”, pword: “bar”) send(data): ftp/payload(data: “hogehogehoge”) Sent to default(first) backend if no name specified. Connection-based backends automatically opened on first send 33
  • 34. Fourteenforty Research Institute, Inc. Monitoring • Currently an optional ‘heartbeat’ can be defined • Detects when the target stops responding • Usually, ICMP or ICMPv6 Echo Requests (pings) • Can specify heartbeat interval (once every n packets) 34
  • 35. Fourteenforty Research Institute, Inc. HeartBeat heart_beat { group { send: ipv4/icmp(icmp_echo_req) recv: recv_ipv4/recv_icmp(recv_icmp_echo) } } The monitoring heartbeat is specified like any other fuzzing rule. Heartbeat can have a different backend. 35
  • 36. Fourteenforty Research Institute, Inc. Example – IPv6 Fuzzing ipv6: version/b4 : 6 trafficclass/b8 : 0 flowlabel/b20 : 0 packet_length/I2: $ilength(<payload>) + $ilength(<headers>) next_header/I1 : $id(<next>) hoplimit/I1 : [127, 255, 0] src_address/B16 : $ipv6_addr($ipv6_src) dest_address/B16 : $ipv6_addr($ipv6_dst) headers/S : <next_sublayer> payload/S : <next_layer> Generates an IPv6 header, and continues into the extension headers. 36
  • 37. Fourteenforty Research Institute, Inc. IPv6 Fuzzing - contd For IPv6, instead of fuzzing values we fuzz structures - Various combinations of chains of extension headers and associated options: send: ipv6(hopbyhop(home_address/quick_start)/routing/esp)/tcp send: ipv6(hopbyhop(home_address/endpoint_ID)/routing/esp)/tcp send: ipv6(hopbyhop(home_address/tunnel_limit)/routing/esp)/tcp send: ipv6(hopbyhop(home_address/router_alert)/routing/esp)/tcp Of course, these are generated by a script. 37
  • 38. Fourteenforty Research Institute, Inc. Example: TCP Fuzzing tcp[0x6]: srcport/I2: 0 dest/I2: $tcp_dst_port seqno/I4: 0 ackno/I4: 0 dataoff/b4: ($ilength($<opts>) / 4) + 5 reserved/b4: 0 cwr/b1: 0 ece/b1: 0 urg/b1: 0 ack/b1: 0 … etc. TCP control bits can be set using overwrites in the scenario file. 38
  • 39. Fourteenforty Research Institute, Inc. TCP Scenario Excerpt group{ send: tcp(seqno:1747422, srcport: 6295, syn: 1, cwr:1, ece:1) recv: recv_tcp send: tcp(seqno:$recv_ack, srcport: 6295, ack: 1, ackno: $recv_seq + 1 , cwr:1, ece:1) recv: recv_tcp send: tcp(seqno:1747423, srcport: 6295,cwr:1, ece:1)/tcp_payload recv: recv_tcp send: tcp(seqno:1747449, srcport: 6295,fin: 1, cwr:1, ece:1)/tcp_payload } Scenario file uses overwrites to control the higher-level behaviour to comply with the TCP protocol. 39
  • 40. Fourteenforty Research Institute, Inc. Demo One – IPv6 • Quick ipv6 fuzzing demo against Windows 7 40
  • 41. Fourteenforty Research Institute, Inc. Demo Two: Router(a) • DoS 41
  • 42. Fourteenforty Research Institute, Inc. Limitations • Speed – Research quality code • Expressiveness – Flow Control in scenarios Small set of backends at present 42
  • 43. Fourteenforty Research Institute, Inc. Future Work • Speediness • Flow Control • More Backends • Macro programming for everyone – Scripting language • More sophisticated monitoring – Likely requires cooperation with vendors for embedded devices – Develop a protocol? • More file-oriented fuzzing support (spawning processes to open generated files, etc) 43
  • 44. Fourteenforty Research Institute, Inc. 44 Thank you! Questions? Fourteenforty Research Institute, Inc. http://www.fourteenforty.jp Nicholas Green green@fourteenforty.jp