SlideShare a Scribd company logo
1 of 57
Download to read offline
What Happens In Windows 7
Stays In Windows 7
Moti Joseph & Marion Marschalek
Troopers Conference 2014
About Us
Moti Joseph
Security Researcher
Marion Marschalek
Malware Analyst
Agenda
• Vulnerabilities
• Automated Vulnerability Search
• An Approach
• A Solution as Proof of Concept
• Demo ;)
• Whats next?
TROOPERS 2014
Intro
Got a bug
in your
software?
Can I haz it??
Chuck Norris On Security.
Vulnerabilities are software mistakes in
specification and design, but mostly mistakes in
programming. Any large software package will
have thousands of mistakes. Once discovered,
they can be used to attack systems. This is the
point of security patching: eliminating known
vulnerabilities. But many systems don't get
patched, so the Internet is filled with known,
exploitable vulnerabilities.
TROOPERS 2014
How to find vulnerabilities?
• Application Penetration Testing
• Fuzzing
• Reverse Engineering
• Source Code Review
• Or.. Being more advanced:
– Tracking software bugs, introducing bugs into
software, reversing security patches
TROOPERS 2014
Who is interested in
finding them?
Hackers
Software Companies
Criminals
Governments
Media
How much does a
0-day vulnerability cost?
TROOPERS 2014
“White Market”
When or why to sell to white market?
TROOPERS 2014
“BlackMarket”
Broker?
Money?
Trust?
TROOPERS 2014
What happens when
you sell to the
black market?
TROOPERS 2014
And why automate it?
It‘s faster!!
–The hacker – can break more
–The software company – can fix faster
–Criminals – can make more money
–Governments – can ... [SECRET]
–Media – has more to write about
TROOPERS 2014
The
Approach
What happens in Windows7
stays in Windows7...
Win7 Win8
quartz.dll quartz.dll
lea ecx, [ebp+cb]
push ecx
push 4
push eax
mov [esi], eax
call ?ULongMult@@YGJKKPAK@Z
test eax, eax
...
push [ebp+cb] ; cb
call
ds:__imp__CoTaskMemAlloc@4
xor eax, eax
inc eax
shl eax, cl
...
shl eax, 2
push eax ; cb
call
ds:__imp__CoTaskMemAlloc@4
Patch it!
TROOPERS 2014
Counting Function Calls
Win7 quartz.lib
Win8 quartz.lib
Spot The Patch
Win7 quartz.lib Win8 quartz.lib
TROOPERS 2014
Intsafe.h & Strsafe.h
• Searching for security patches:
–Type Conversion
–Safe Math Functions
–Buffer Boundary Checks on Strings
• Set of 130 Signatures of ‚Safe Functions‘
TROOPERS 2014
‚Safe Functions‘
UInt8Add
UShortAdd
UIntAdd
ULongAdd
SizeTAdd
ULongLongAdd
UInt8Sub
UShortSub
UIntSub
ULongSub
SizeTSub
ULongLongSub
UInt8ToInt8
UInt8ToChar
ByteToInt8
ByteToChar
ShortToInt8
ShortToUChar
ShortToChar
UShortToUInt8
UShortToShort
IntToInt8
IntToUChar
IntToChar
StringCbGets
StringCbGetsEx
StringCbLength
StringCbPrintf
StringCbPrintfEx
StringCbVPrintf
StringCbVPrintfEx
StringCchCat
StringCchCatEx
StringCchCatN
StringCchCatNEx
StringCchCopy
... and many many more ....
TROOPERS 2014
The Approach
Flexible.
Extendible.
Awesome.
Windows Library
Parsing to DB
Checking for
Vulnerability
Decompilation
or Disassembly
Diffing Library
with New Version
TROOPERS 2014
The
Solution
Pretty, eh??
Getting the .C
Library Conversion using IDA Pro
means: .dll -> .idb -> .c
TROOPERS 2014
Library Parsing
• DiffRay on https://github.com/pinkflawd/DiffRay
• Parses a library / directory of libraries
• Manages libraries , functions
and signature hits
• Diff libraries functionwise
– Based on library ID
or library name pattern
TROOPERS 2014
The Database
MSSql or SQLite
TROOPERS 2014
Diff it!
• Compare libraries on a function basis
• Extract hits per function per signature
TROOPERS 2014
DiffRay HowTo: Configuration
• signatures.conf – whatever symbols you‘re
searching for
• sig_mappings.conf – mappings for signatures
• logger.conf – logging output and formatting,
details to be found at
http://docs.python.org/2/howto/logging.html
• mssql.conf – MSSql access credentials
TROOPERS 2014
DiffRay HowTo: CMD Parsing
Maintenance:
python [dir]srcMain.py --create-scheme --update-sigs
python [dir]srcMain.py --parse [library_path]
--os [Win7|Win8] --type [C|LST]
python [dir]srcMain.py --dirparse [directory_path]
--os [Win7|Win8] --type [C|LST]
python [dir]srcMain.py --flushall
Switches:
--backend [mssql|sqlite]
--no-flush
TROOPERS 2014
DiffRay HowTo: CMD Diffing
Info Output & Diffing:
python [dir]srcMain.py –-search_libs [libname_pattern]
python [dir]srcMain.py –-lib_all_info [lib_id]
python [dir]srcMain.py –-diff
--lib_1 [win7lib] --lib_2 [win8lib]
python [dir]srcMain.py –-diff_byname [libname_pattern]
TROOPERS 2014
DEMO TIME
Findings
Windows 7 (ULongAdd)
bcrypt.dll!ConvertRsaPrivateBlobToFullRsa
Windows 8
bcrypt.dll!ConvertRsaPrivateBlobToFullRsa
Windows 8 (ULongAdd)
netlogon.dll! NlpAddResourceGroupsToSamInfo
Windows 7
netlogon.dll! NlpAddResourceGroupsToSamInfo
Windows 8 /ULongLongToUint
twext.dll! EscapeField
Windows 7 Integer overflow
twext.dll! EscapeField
Drrrivers...
Windows 8
cng.dll! ConvertRsaPrivateBlogToFullRsa
Windows 7
cng.dll! ConvertRsaPrivateBlogToFullRsa
Windows 8
ksecdd.dll! SspiCopyAuthIdentity
Windows 7
ksecdd.dll! SspiCopyAuthIdentity
Windows 8
srvnet.dll!
SrvNetAllocatePoolWithTagPriority
Windows 7
srvnet.dll!
SrvNetAllocatePoolWithTagPriority
Triggerable?
Or not triggerable?
Windows 7
cryptdlg!DecodeAttrSequence
Windows 8
cryptdlg!DecodeAttrSequence
What’s CryptDll.dll??
TROOPERS 2014
StringCchLength
TROOPERS 2014
CryptDecodeObject API
TROOPERS 2014
Certificate DialogBox
TROOPERS 2014
What‘s
Next
Whats Next
• Possible Extensions
– Win8, we‘re coming!!
– Extended signatures
– Symbolic Execution FTW
• Improvements
– Transparent DB library
• Known issues
– Duplicate hits, false positives, slooow,
output is not handy
TROOPERS 2014
Happy Diffing.

More Related Content

Similar to Troopers Diffray v1.1

Flash security past_present_future_final_en
Flash security past_present_future_final_enFlash security past_present_future_final_en
Flash security past_present_future_final_en
Sunghun Kim
 

Similar to Troopers Diffray v1.1 (20)

Zen and the art of Security Testing
Zen and the art of Security TestingZen and the art of Security Testing
Zen and the art of Security Testing
 
Software testing (2) trainingin-mumbai
Software testing (2) trainingin-mumbaiSoftware testing (2) trainingin-mumbai
Software testing (2) trainingin-mumbai
 
Software testing (2) trainingin-mumbai...
Software testing (2) trainingin-mumbai...Software testing (2) trainingin-mumbai...
Software testing (2) trainingin-mumbai...
 
CheckPlease - Payload-Agnostic Implant Security
CheckPlease - Payload-Agnostic Implant SecurityCheckPlease - Payload-Agnostic Implant Security
CheckPlease - Payload-Agnostic Implant Security
 
Safety Bot Guaranteed -- Shmoocon 2017
Safety Bot Guaranteed -- Shmoocon 2017Safety Bot Guaranteed -- Shmoocon 2017
Safety Bot Guaranteed -- Shmoocon 2017
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
What is happening with my microservices?
What is happening with my microservices?What is happening with my microservices?
What is happening with my microservices?
 
Introducing IoT Crusher (Open Source Version)
Introducing IoT Crusher (Open Source Version)Introducing IoT Crusher (Open Source Version)
Introducing IoT Crusher (Open Source Version)
 
AI on Spark for Malware Analysis and Anomalous Threat Detection
AI on Spark for Malware Analysis and Anomalous Threat DetectionAI on Spark for Malware Analysis and Anomalous Threat Detection
AI on Spark for Malware Analysis and Anomalous Threat Detection
 
Introduction to Metasploit
Introduction to MetasploitIntroduction to Metasploit
Introduction to Metasploit
 
Splunk Enterprise for InfoSec Hands-On Breakout Session
Splunk Enterprise for InfoSec Hands-On Breakout SessionSplunk Enterprise for InfoSec Hands-On Breakout Session
Splunk Enterprise for InfoSec Hands-On Breakout Session
 
Introduction to metasploit
Introduction to metasploitIntroduction to metasploit
Introduction to metasploit
 
How to find Zero day vulnerabilities
How to find Zero day vulnerabilitiesHow to find Zero day vulnerabilities
How to find Zero day vulnerabilities
 
Software Analytics: Data Analytics for Software Engineering and Security
Software Analytics: Data Analytics for Software Engineering and SecuritySoftware Analytics: Data Analytics for Software Engineering and Security
Software Analytics: Data Analytics for Software Engineering and Security
 
Cyber Security Workshop Presentation.pptx
Cyber Security Workshop Presentation.pptxCyber Security Workshop Presentation.pptx
Cyber Security Workshop Presentation.pptx
 
The hardcore stuff i hack, experiences from past VAPT assignments
The hardcore stuff i hack, experiences from past VAPT assignmentsThe hardcore stuff i hack, experiences from past VAPT assignments
The hardcore stuff i hack, experiences from past VAPT assignments
 
How to get along with HATEOAS without letting the bad guys steal your lunch?
How to get along with HATEOAS without letting the bad guys steal your lunch?How to get along with HATEOAS without letting the bad guys steal your lunch?
How to get along with HATEOAS without letting the bad guys steal your lunch?
 
WTF is Penetration Testing v.2
WTF is Penetration Testing v.2WTF is Penetration Testing v.2
WTF is Penetration Testing v.2
 
Flash security past_present_future_final_en
Flash security past_present_future_final_enFlash security past_present_future_final_en
Flash security past_present_future_final_en
 
Observability für alle
Observability für alleObservability für alle
Observability für alle
 

More from pinkflawd (9)

The Magic Superpowers of a well-established "Us"
The Magic Superpowers of a well-established "Us"The Magic Superpowers of a well-established "Us"
The Magic Superpowers of a well-established "Us"
 
La Quadrature Du Cercle - The APTs That Weren't
La Quadrature Du Cercle - The APTs That Weren'tLa Quadrature Du Cercle - The APTs That Weren't
La Quadrature Du Cercle - The APTs That Weren't
 
Big Game Hunting - Peculiarities In Nation State Malware Research
Big Game Hunting - Peculiarities In Nation State Malware ResearchBig Game Hunting - Peculiarities In Nation State Malware Research
Big Game Hunting - Peculiarities In Nation State Malware Research
 
Shooting
ShootingShooting
Shooting
 
The A and the P of the T
The A and the P of the TThe A and the P of the T
The A and the P of the T
 
Zeus' Not Dead Yet
Zeus' Not Dead YetZeus' Not Dead Yet
Zeus' Not Dead Yet
 
TS/NOFORN
TS/NOFORNTS/NOFORN
TS/NOFORN
 
Catch Me If You Can
Catch Me If You CanCatch Me If You Can
Catch Me If You Can
 
Curing A 15 Year Old Desease
Curing A 15 Year Old DeseaseCuring A 15 Year Old Desease
Curing A 15 Year Old Desease
 

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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+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@
 

Recently uploaded (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
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
 
+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...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

Troopers Diffray v1.1