SlideShare uma empresa Scribd logo
1 de 50
Baixar para ler offline
0DAY HUNTING
A.K.A.
THE STORY OF A PROPER CPE TEST
Balazs Bucsay - Research Director @ MRG Effitas
OSCE, OSCP, OSWP, GIAC GPEN
@xoreipeip # http://rycon.hu
BIO / BALAZS BUCSAY
• Hungarian hacker
@xoreipeip
BIO / BALAZS BUCSAY
• Hungarian hacker
• Research Director @ MRG Effitas
• Strictly technical certificates: OSCE, OSCP,
OSWP and GIAC GPEN
• Previously worked as an ethical hacker
• Started with ring0 debuggers and
disassemblers in 2000 (13 years old)
• Major project in 2009: GI John
@xoreipeip
• Webpage: http://rycon.hu
• Twitter: @xoreipeip
• Linkedin: 

https://www.linkedin.com/in/bucsayb
BIO / BALAZS BUCSAY
@xoreipeip
PRESENTATIONS
• Talks around the world: • Atlanta (US)
• Moscow (RU)
• London (UK)
• Oslo (NO)
• Vienna (AT)
• Budapest (HU)
• Latest presentation: • Chw00t: Breaking unices’ chroot solutions
• https://github.com/earthquake/chw00t
• Slides: http://bit.ly/1T78dfM
@xoreipeip
WORK VS PASSION
• This presentation and findings are not related to my daily work
• Did all this research in my free time
• Don’t like black boxes and closed source
• Although if you are interested in testing your device contact us!
@xoreipeip
• None of the vendors care about security
• I was afraid of all the juicy RCE bugs are gone now
• Truth is: nobody cares, old bugs are there and will be there
• Most of the embedded devices are running on old 2.4 kernels
• Worked for the second largest mobile operator doing CPE tests
• Found several RCE, Auth bypasses, XSSs in different devices
CUSTOMER PREMISES EQUIPMENT - CPE
@xoreipeip
• Not gonna mention the ISP’s name
• Huge ISP in Europe, it has subsidiaries at least in 8 EU countries
• Distributed to more than 6 million customers around Europe
(based on the ISP’s website)
• Mostly covered by the following devices
TODAY’S DEVICE
@xoreipeip
CISCO EPC3925
@xoreipeip
CISCO EPC3925 - PWNED
@xoreipeip
TECHNICOLOR TC7200
@xoreipeip
TECHNICOLOR TC7200 - PWNED
Nice walk-through by Peter Geissler (@bl4sty) on Hack in The box
Amsterdam: http://bit.ly/215GwaN @xoreipeip
TECHNICOLOR TC7200 - PWNED
• Blasty dumped the memory
• Reverse engineered the ESSID and WPA2-PSK generator
• PSK generator based on ESSID: http://bit.ly/1UnMvTT
(TC7200 only)
Long story short:
@xoreipeip
UBEE EVW3226 - PWNED??
@xoreipeip
UBEE EVW3226 - PWNED??
• People started to play seriously with the device around January
of 2016
• 0day exploit released (physical access needed) - did not work
for me
• Flash content was dumped and uploaded in the same month
• SEC Consult identified overlapping vulns: http://bit.ly/25KdjFK
• Yolosec released a tool as well: http://bit.ly/29isodH
@xoreipeip
THE PLAN
• GOAL 0: get the dump of the filesystem
• GOAL 1: get full access to the device
• GOAL 2: get unauthenticated command/code execution
• GOAL 3: get access to the network
• …
• Profit
@xoreipeip
GOAL 1: GET FULL ACCESS TO THE DEVICE
• Blackbox approach did not succeed
• Filesystem dump was released
• Device is using lighttpd with a custom .cgi binary
• Fired up IDA Pro to look for injection points
@xoreipeip
JUST A FEW TO MENTION
@xoreipeip
JUST A FEW TO MENTION
@xoreipeip
JUST A FEW TO MENTION
@xoreipeip
CAN YOU SPOT IT?
@xoreipeip
RCE AS IT’S BEST
EXPLOITATION
• The code can be invoked by starting a certain feature of the device
• Two injection points
• ESSID: max 32 ASCII character - although does not accept
everything
• PSK: max 64 ASCII character - accepts all necessary characters
• Admin must be authenticated and connected to the internal
network
@xoreipeip
*BA DUM TSSS*
@xoreipeip
GOAL 2: FIND UNAUTHENTICATED RCE/BOF
• Although we have full access to the device, we still need an
admin user to exploit it
• Authentication bypass can be a solution
• Unauthenticated RCE or BOF can help too
@xoreipeip
CAN YOU SPOT IT?
@xoreipeip
VANILLA STACK OVERFLOW
Pros:
• Unauthenticated like I wished for
• Trivial? vanilla stack overflow

Cons:
• Big endian Linux on ARM - no public shell code
• No experience with ARM
• No qemu-system for big endian ARM, only qemu-user
@xoreipeip
SHELLCODING
• Compiling big endian toolchain with Buildroot
• Compiling static gdbserver for the device
• Debugging the binary for exploitation
• Writing shellcode based on tutorials and others
• Linux ARM big endian bind shell code merged into Metasploit

https://github.com/rapid7/metasploit-framework/pull/6959
@xoreipeip
IN THE GDBSERVER
• No next or nexti, must put breakpoints on every instruction
• Most of the features are gone
• stack is not executable - no features, did not check…
• turns off stack randomisation (not vanilla anymore) - had to
write ROP
• turns off ASLR (infoleak needed)
@xoreipeip
EPIC FAIL
• Only 11bit is randomised, 1/2048 chance to hit the address
• Webserver forked the process, new memory address every time
• Watchdog restarts the web server
• Then realised that lighttpd filters most of the characters ->
unexploitable
@xoreipeip
AUTHENTICATION BYPASS
• Found by Search-lab
• Makes authenticated RCE to unauthenticated
• http://www.search-lab.hu/advisories/122-ubee-evw3226-
modem-router-multiple-vulnerabilities
@xoreipeip
GOAL 3: GET ACCESS TO THE NETWORK
• Fallback options:
• admin:admin account still could work in default cases
• previously generated backup can be downloaded
• We only need access to the internal network to get full access
• Let’s dig the binaries
@xoreipeip
BACK OF THE BLACKBOX
@xoreipeip
FEW SYMBOLS
FROM THE
BINARIES
Some of these could be
interesting
@xoreipeip
WPA2-PSK GENERATION ALGORITHM
@xoreipeip
WPA2-PSK, SSID, WPS PIN GENERATION ALGORITHM
• Based only on MAC address, nothing else
• Depends on whether it is 5G or 2.4G
• MAC can be sniffed
• WPS-PIN generation is based on the same idea
• Algorithm released 3rd of July by Yolosec
@xoreipeip
SURPRISE SURPRISE!
WPS-PIN ENABLED BY DEFAULT
@xoreipeip
GETTING INTO THE NETWORK
• What if the user changed the SSID?
@xoreipeip
GETTING INTO THE NETWORK
• If the user changed the SSID: you can still get the passphrase
@xoreipeip
GETTING INTO THE NETWORK
• If the user changed the SSID: you can still get the passphrase
• What if the user changed the PSK?
@xoreipeip
GETTING INTO THE NETWORK
• If the user changed the SSID: you can still get the passphrase
• If the user changed the PSK: let’s generate the WPS-PIN
• All of these can be generated from the MAC address
• From nothing to root in 2 minutes (default credentials)
@xoreipeip
DEMO
@xoreipeip
THE VENDOR HELPS YOU
it’s easier when you have a map - blue dots are the modems
@xoreipeip
Authenticated firmware upgrade^W^W^W buffer overflow
WHO NEEDS MORE?
@xoreipeip
and if you are too lazy to crack a password…
WHO NEEDS MORE?
@xoreipeip
and if you are too lazy to crack a password…
WHO NEEDS MORE?
@xoreipeip
FURTHER VULNERABILITIES
• Previously requested backup can be downloaded without
authentication
• Plaintext passwords all over the device (nvram, heap, configs)
• Backdoor users in passwd and shadow files
• Command injections and buffer overflows
@xoreipeip
IMPACT
• Few million customer is potentially vulnerable
• Anybody can access their network, get root in a few minutes
• Botnets, jump hosts, tor gateways, etc.
• Newest Snowden leaks: secret services use MiTM on routers
• You cannot be sure that you don’t have a device like this at home
!
!
@xoreipeip
Balazs Bucsay - @xoreipeip
Thank you for your attention!
!
Q&A

Mais conteúdo relacionado

Mais procurados

Csw2016 tang virtualization_device emulator testing technology
Csw2016 tang virtualization_device emulator testing technologyCsw2016 tang virtualization_device emulator testing technology
Csw2016 tang virtualization_device emulator testing technology
CanSecWest
 
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
You didnt see it’s coming? "Dawn of hardened Windows Kernel" You didnt see it’s coming? "Dawn of hardened Windows Kernel"
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
Peter Hlavaty
 
HackInTheBox - AMS 2011 , Spying on SpyEye - What Lies Beneath ?
HackInTheBox -  AMS 2011 , Spying on SpyEye - What Lies Beneath ?HackInTheBox -  AMS 2011 , Spying on SpyEye - What Lies Beneath ?
HackInTheBox - AMS 2011 , Spying on SpyEye - What Lies Beneath ?
Aditya K Sood
 

Mais procurados (20)

Csw2016 tang virtualization_device emulator testing technology
Csw2016 tang virtualization_device emulator testing technologyCsw2016 tang virtualization_device emulator testing technology
Csw2016 tang virtualization_device emulator testing technology
 
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
You didnt see it’s coming? "Dawn of hardened Windows Kernel" You didnt see it’s coming? "Dawn of hardened Windows Kernel"
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
 
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
 
Lares from LOW to PWNED
Lares from LOW to PWNEDLares from LOW to PWNED
Lares from LOW to PWNED
 
Flash it baby!
Flash it baby!Flash it baby!
Flash it baby!
 
When is something overflowing
When is something overflowingWhen is something overflowing
When is something overflowing
 
Us 16-subverting apple-graphics_practical_approaches_to_remotely_gaining_root...
Us 16-subverting apple-graphics_practical_approaches_to_remotely_gaining_root...Us 16-subverting apple-graphics_practical_approaches_to_remotely_gaining_root...
Us 16-subverting apple-graphics_practical_approaches_to_remotely_gaining_root...
 
AV Evasion with the Veil Framework
AV Evasion with the Veil FrameworkAV Evasion with the Veil Framework
AV Evasion with the Veil Framework
 
Cloud Device Insecurity
Cloud Device InsecurityCloud Device Insecurity
Cloud Device Insecurity
 
Invoke-Obfuscation nullcon 2017
Invoke-Obfuscation nullcon 2017Invoke-Obfuscation nullcon 2017
Invoke-Obfuscation nullcon 2017
 
The State of WebSockets in Django
The State of WebSockets in DjangoThe State of WebSockets in Django
The State of WebSockets in Django
 
Entomology 101
Entomology 101Entomology 101
Entomology 101
 
Building an Empire with PowerShell
Building an Empire with PowerShellBuilding an Empire with PowerShell
Building an Empire with PowerShell
 
Big Bang Theory: The Evolution of Pentesting High Security Enviroments IT Def...
Big Bang Theory: The Evolution of Pentesting High Security Enviroments IT Def...Big Bang Theory: The Evolution of Pentesting High Security Enviroments IT Def...
Big Bang Theory: The Evolution of Pentesting High Security Enviroments IT Def...
 
Modern Reconnaissance Phase on APT - protection layer
Modern Reconnaissance Phase on APT - protection layerModern Reconnaissance Phase on APT - protection layer
Modern Reconnaissance Phase on APT - protection layer
 
Pentester++
Pentester++Pentester++
Pentester++
 
Appsec DC - wXf -2010
Appsec DC - wXf  -2010Appsec DC - wXf  -2010
Appsec DC - wXf -2010
 
HackInTheBox - AMS 2011 , Spying on SpyEye - What Lies Beneath ?
HackInTheBox -  AMS 2011 , Spying on SpyEye - What Lies Beneath ?HackInTheBox -  AMS 2011 , Spying on SpyEye - What Lies Beneath ?
HackInTheBox - AMS 2011 , Spying on SpyEye - What Lies Beneath ?
 
Software Security : From school to reality and back!
Software Security : From school to reality and back!Software Security : From school to reality and back!
Software Security : From school to reality and back!
 
Obfuscating The Empire
Obfuscating The EmpireObfuscating The Empire
Obfuscating The Empire
 

Destaque

Alan kakareka. insight into russian black market
Alan kakareka. insight into russian black marketAlan kakareka. insight into russian black market
Alan kakareka. insight into russian black market
Yury Chemerkin
 
Alfonso De Gregorio - Vulnerabilities and Their Surrounding Ethical Questions...
Alfonso De Gregorio - Vulnerabilities and Their Surrounding Ethical Questions...Alfonso De Gregorio - Vulnerabilities and Their Surrounding Ethical Questions...
Alfonso De Gregorio - Vulnerabilities and Their Surrounding Ethical Questions...
HackIT Ukraine
 

Destaque (8)

Webapplicationsecurity05 2010 100601100553 Phpapp02
Webapplicationsecurity05 2010 100601100553 Phpapp02Webapplicationsecurity05 2010 100601100553 Phpapp02
Webapplicationsecurity05 2010 100601100553 Phpapp02
 
The Market for Cyber Weapons - NATO Cooperative Cyber Defence Centre of Exce...
 The Market for Cyber Weapons - NATO Cooperative Cyber Defence Centre of Exce... The Market for Cyber Weapons - NATO Cooperative Cyber Defence Centre of Exce...
The Market for Cyber Weapons - NATO Cooperative Cyber Defence Centre of Exce...
 
Alan kakareka. insight into russian black market
Alan kakareka. insight into russian black marketAlan kakareka. insight into russian black market
Alan kakareka. insight into russian black market
 
Alfonso De Gregorio - Vulnerabilities and Their Surrounding Ethical Questions...
Alfonso De Gregorio - Vulnerabilities and Their Surrounding Ethical Questions...Alfonso De Gregorio - Vulnerabilities and Their Surrounding Ethical Questions...
Alfonso De Gregorio - Vulnerabilities and Their Surrounding Ethical Questions...
 
Vulnerability Intelligence and Assessment with vulners.com
Vulnerability Intelligence and Assessment with vulners.comVulnerability Intelligence and Assessment with vulners.com
Vulnerability Intelligence and Assessment with vulners.com
 
Advanced Persistent Threats (APTs) - Information Security Management
Advanced Persistent Threats (APTs) - Information Security ManagementAdvanced Persistent Threats (APTs) - Information Security Management
Advanced Persistent Threats (APTs) - Information Security Management
 
Spot the Web Vulnerability
Spot the Web VulnerabilitySpot the Web Vulnerability
Spot the Web Vulnerability
 
Ibrahim balic cyber-weapons
Ibrahim balic cyber-weaponsIbrahim balic cyber-weapons
Ibrahim balic cyber-weapons
 

Semelhante a 0Day Hunting A.K.A. The Story of a Proper CPE Test by Balazs Bacsay

XFLTReaT: A New Dimension In Tunnelling (DeepSec 2017)
XFLTReaT: A New Dimension In Tunnelling (DeepSec 2017)XFLTReaT: A New Dimension In Tunnelling (DeepSec 2017)
XFLTReaT: A New Dimension In Tunnelling (DeepSec 2017)
Balazs Bucsay
 
XFLTReaT: A New Dimension in Tunnelling (HITB GSEC 2017)
XFLTReaT: A New Dimension in Tunnelling (HITB GSEC 2017)XFLTReaT: A New Dimension in Tunnelling (HITB GSEC 2017)
XFLTReaT: A New Dimension in Tunnelling (HITB GSEC 2017)
Balazs Bucsay
 
Balázs Bucsay - XFLTReaT: Building a Tunnel
Balázs Bucsay - XFLTReaT: Building a TunnelBalázs Bucsay - XFLTReaT: Building a Tunnel
Balázs Bucsay - XFLTReaT: Building a Tunnel
hacktivity
 
Trick or XFLTReaT a.k.a. Tunnel All The Things
Trick or XFLTReaT a.k.a. Tunnel All The ThingsTrick or XFLTReaT a.k.a. Tunnel All The Things
Trick or XFLTReaT a.k.a. Tunnel All The Things
Balazs Bucsay
 
XFLTReaT: a new dimension in tunnelling (BruCON 0x09 2017)
XFLTReaT: a new dimension in tunnelling (BruCON 0x09 2017)XFLTReaT: a new dimension in tunnelling (BruCON 0x09 2017)
XFLTReaT: a new dimension in tunnelling (BruCON 0x09 2017)
Balazs Bucsay
 
XFLTReaT: A New Dimension in Tunneling (Shakacon 2017)
XFLTReaT: A New Dimension in Tunneling (Shakacon 2017)XFLTReaT: A New Dimension in Tunneling (Shakacon 2017)
XFLTReaT: A New Dimension in Tunneling (Shakacon 2017)
Balazs Bucsay
 
libinjection: from SQLi to XSS  by Nick Galbreath
libinjection: from SQLi to XSS  by Nick Galbreathlibinjection: from SQLi to XSS  by Nick Galbreath
libinjection: from SQLi to XSS  by Nick Galbreath
CODE BLUE
 

Semelhante a 0Day Hunting A.K.A. The Story of a Proper CPE Test by Balazs Bacsay (20)

XFLTReaT: A New Dimension In Tunnelling (DeepSec 2017)
XFLTReaT: A New Dimension In Tunnelling (DeepSec 2017)XFLTReaT: A New Dimension In Tunnelling (DeepSec 2017)
XFLTReaT: A New Dimension In Tunnelling (DeepSec 2017)
 
XFLTReaT: A New Dimension in Tunnelling (HITB GSEC 2017)
XFLTReaT: A New Dimension in Tunnelling (HITB GSEC 2017)XFLTReaT: A New Dimension in Tunnelling (HITB GSEC 2017)
XFLTReaT: A New Dimension in Tunnelling (HITB GSEC 2017)
 
Balázs Bucsay - XFLTReaT: Building a Tunnel
Balázs Bucsay - XFLTReaT: Building a TunnelBalázs Bucsay - XFLTReaT: Building a Tunnel
Balázs Bucsay - XFLTReaT: Building a Tunnel
 
Trick or XFLTReaT a.k.a. Tunnel All The Things
Trick or XFLTReaT a.k.a. Tunnel All The ThingsTrick or XFLTReaT a.k.a. Tunnel All The Things
Trick or XFLTReaT a.k.a. Tunnel All The Things
 
XFLTReaT: a new dimension in tunnelling (BruCON 0x09 2017)
XFLTReaT: a new dimension in tunnelling (BruCON 0x09 2017)XFLTReaT: a new dimension in tunnelling (BruCON 0x09 2017)
XFLTReaT: a new dimension in tunnelling (BruCON 0x09 2017)
 
Hogy jussunk ki lezárt hálózatokból?
Hogy jussunk ki lezárt hálózatokból?Hogy jussunk ki lezárt hálózatokból?
Hogy jussunk ki lezárt hálózatokból?
 
XFLTReaT: A New Dimension in Tunneling (Shakacon 2017)
XFLTReaT: A New Dimension in Tunneling (Shakacon 2017)XFLTReaT: A New Dimension in Tunneling (Shakacon 2017)
XFLTReaT: A New Dimension in Tunneling (Shakacon 2017)
 
XFLTReat: a new dimension in tunnelling
XFLTReat:  a new dimension in tunnellingXFLTReat:  a new dimension in tunnelling
XFLTReat: a new dimension in tunnelling
 
Principles, Backbone and Bottlenose
Principles, Backbone and BottlenosePrinciples, Backbone and Bottlenose
Principles, Backbone and Bottlenose
 
GitHub Actions Security
GitHub Actions SecurityGitHub Actions Security
GitHub Actions Security
 
ANP catalog: the adversarial ninja playset
ANP catalog: the adversarial ninja playsetANP catalog: the adversarial ninja playset
ANP catalog: the adversarial ninja playset
 
Great Tools Heavily Used In Japan, You Don't Know.
Great Tools Heavily Used In Japan, You Don't Know.Great Tools Heavily Used In Japan, You Don't Know.
Great Tools Heavily Used In Japan, You Don't Know.
 
R0boCamp2016 Гліб Вінніков Home automation by ESP8266
R0boCamp2016  Гліб Вінніков  Home automation by ESP8266R0boCamp2016  Гліб Вінніков  Home automation by ESP8266
R0boCamp2016 Гліб Вінніков Home automation by ESP8266
 
GitHub Actions Security - DDOG
GitHub Actions Security - DDOGGitHub Actions Security - DDOG
GitHub Actions Security - DDOG
 
IAA Life in Lockdown series: Securing Internet Routing
IAA Life in Lockdown series: Securing Internet RoutingIAA Life in Lockdown series: Securing Internet Routing
IAA Life in Lockdown series: Securing Internet Routing
 
EhTrace -- RoP Hooks
EhTrace -- RoP HooksEhTrace -- RoP Hooks
EhTrace -- RoP Hooks
 
BSides_Charm2015_Info sec hunters_gathers
BSides_Charm2015_Info sec hunters_gathersBSides_Charm2015_Info sec hunters_gathers
BSides_Charm2015_Info sec hunters_gathers
 
libinjection: from SQLi to XSS  by Nick Galbreath
libinjection: from SQLi to XSS  by Nick Galbreathlibinjection: from SQLi to XSS  by Nick Galbreath
libinjection: from SQLi to XSS  by Nick Galbreath
 
Intro to Hardware Firmware Hacking
Intro to Hardware Firmware HackingIntro to Hardware Firmware Hacking
Intro to Hardware Firmware Hacking
 
HTTP/2 in Examples
HTTP/2 in ExamplesHTTP/2 in Examples
HTTP/2 in Examples
 

Mais de Shakacon

Pwned in Translation - from Subtitles to RCE
Pwned in Translation - from Subtitles to RCEPwned in Translation - from Subtitles to RCE
Pwned in Translation - from Subtitles to RCE
Shakacon
 
Oversight: Exposing spies on macOS
Oversight: Exposing spies on macOS Oversight: Exposing spies on macOS
Oversight: Exposing spies on macOS
Shakacon
 
A Decompiler for Blackhain-Based Smart Contracts Bytecode
A Decompiler for Blackhain-Based Smart Contracts BytecodeA Decompiler for Blackhain-Based Smart Contracts Bytecode
A Decompiler for Blackhain-Based Smart Contracts Bytecode
Shakacon
 
Reviewing the Security of ASoC Drivers in Android Kernel
Reviewing the Security of ASoC Drivers in Android KernelReviewing the Security of ASoC Drivers in Android Kernel
Reviewing the Security of ASoC Drivers in Android Kernel
Shakacon
 
When Encryption is Not Enough...Sumanth Naropanth, Chandra Prakash Gopalaiah ...
When Encryption is Not Enough...Sumanth Naropanth, Chandra Prakash Gopalaiah ...When Encryption is Not Enough...Sumanth Naropanth, Chandra Prakash Gopalaiah ...
When Encryption is Not Enough...Sumanth Naropanth, Chandra Prakash Gopalaiah ...
Shakacon
 
Making a Scalable Automated Hacking System by Artem Dinaburg
Making a Scalable Automated Hacking System by Artem DinaburgMaking a Scalable Automated Hacking System by Artem Dinaburg
Making a Scalable Automated Hacking System by Artem Dinaburg
Shakacon
 

Mais de Shakacon (20)

Web (dis)assembly
Web (dis)assemblyWeb (dis)assembly
Web (dis)assembly
 
Macdoored
MacdooredMacdoored
Macdoored
 
I can be apple and so can you
I can be apple and so can youI can be apple and so can you
I can be apple and so can you
 
Cloud forensics putting the bits back together
Cloud forensics putting the bits back togetherCloud forensics putting the bits back together
Cloud forensics putting the bits back together
 
Pwned in Translation - from Subtitles to RCE
Pwned in Translation - from Subtitles to RCEPwned in Translation - from Subtitles to RCE
Pwned in Translation - from Subtitles to RCE
 
Oversight: Exposing spies on macOS
Oversight: Exposing spies on macOS Oversight: Exposing spies on macOS
Oversight: Exposing spies on macOS
 
Shamoon
ShamoonShamoon
Shamoon
 
A Decompiler for Blackhain-Based Smart Contracts Bytecode
A Decompiler for Blackhain-Based Smart Contracts BytecodeA Decompiler for Blackhain-Based Smart Contracts Bytecode
A Decompiler for Blackhain-Based Smart Contracts Bytecode
 
Honey, I Stole Your C2 Server: A Dive into Attacker Infrastructure
Honey, I Stole Your C2 Server:  A Dive into Attacker InfrastructureHoney, I Stole Your C2 Server:  A Dive into Attacker Infrastructure
Honey, I Stole Your C2 Server: A Dive into Attacker Infrastructure
 
Dock ir incident response in a containerized, immutable, continually deploy...
Dock ir   incident response in a containerized, immutable, continually deploy...Dock ir   incident response in a containerized, immutable, continually deploy...
Dock ir incident response in a containerized, immutable, continually deploy...
 
Reviewing the Security of ASoC Drivers in Android Kernel
Reviewing the Security of ASoC Drivers in Android KernelReviewing the Security of ASoC Drivers in Android Kernel
Reviewing the Security of ASoC Drivers in Android Kernel
 
Silent Protest: A Wearable Protest Network
Silent Protest:  A Wearable Protest NetworkSilent Protest:  A Wearable Protest Network
Silent Protest: A Wearable Protest Network
 
WiFi-Based IMSI Catcher
WiFi-Based IMSI CatcherWiFi-Based IMSI Catcher
WiFi-Based IMSI Catcher
 
Sad Panda Analysts: Devolving Malware
Sad Panda Analysts:  Devolving MalwareSad Panda Analysts:  Devolving Malware
Sad Panda Analysts: Devolving Malware
 
reductio [ad absurdum]
reductio [ad absurdum]reductio [ad absurdum]
reductio [ad absurdum]
 
When Encryption is Not Enough...Sumanth Naropanth, Chandra Prakash Gopalaiah ...
When Encryption is Not Enough...Sumanth Naropanth, Chandra Prakash Gopalaiah ...When Encryption is Not Enough...Sumanth Naropanth, Chandra Prakash Gopalaiah ...
When Encryption is Not Enough...Sumanth Naropanth, Chandra Prakash Gopalaiah ...
 
The Search for the Perfect Door - Deviant Ollam
The Search for the Perfect Door - Deviant OllamThe Search for the Perfect Door - Deviant Ollam
The Search for the Perfect Door - Deviant Ollam
 
Swift Reversing by Ryan Stortz
Swift Reversing by Ryan StortzSwift Reversing by Ryan Stortz
Swift Reversing by Ryan Stortz
 
Making a Scalable Automated Hacking System by Artem Dinaburg
Making a Scalable Automated Hacking System by Artem DinaburgMaking a Scalable Automated Hacking System by Artem Dinaburg
Making a Scalable Automated Hacking System by Artem Dinaburg
 
Hunting Government Back Doors by Joseph Menn
Hunting Government Back Doors by Joseph MennHunting Government Back Doors by Joseph Menn
Hunting Government Back Doors by Joseph Menn
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

0Day Hunting A.K.A. The Story of a Proper CPE Test by Balazs Bacsay

  • 1. 0DAY HUNTING A.K.A. THE STORY OF A PROPER CPE TEST Balazs Bucsay - Research Director @ MRG Effitas OSCE, OSCP, OSWP, GIAC GPEN @xoreipeip # http://rycon.hu
  • 2. BIO / BALAZS BUCSAY • Hungarian hacker @xoreipeip
  • 3.
  • 4. BIO / BALAZS BUCSAY • Hungarian hacker • Research Director @ MRG Effitas • Strictly technical certificates: OSCE, OSCP, OSWP and GIAC GPEN • Previously worked as an ethical hacker • Started with ring0 debuggers and disassemblers in 2000 (13 years old) • Major project in 2009: GI John @xoreipeip
  • 5. • Webpage: http://rycon.hu • Twitter: @xoreipeip • Linkedin: 
 https://www.linkedin.com/in/bucsayb BIO / BALAZS BUCSAY @xoreipeip
  • 6. PRESENTATIONS • Talks around the world: • Atlanta (US) • Moscow (RU) • London (UK) • Oslo (NO) • Vienna (AT) • Budapest (HU) • Latest presentation: • Chw00t: Breaking unices’ chroot solutions • https://github.com/earthquake/chw00t • Slides: http://bit.ly/1T78dfM @xoreipeip
  • 7. WORK VS PASSION • This presentation and findings are not related to my daily work • Did all this research in my free time • Don’t like black boxes and closed source • Although if you are interested in testing your device contact us! @xoreipeip
  • 8. • None of the vendors care about security • I was afraid of all the juicy RCE bugs are gone now • Truth is: nobody cares, old bugs are there and will be there • Most of the embedded devices are running on old 2.4 kernels • Worked for the second largest mobile operator doing CPE tests • Found several RCE, Auth bypasses, XSSs in different devices CUSTOMER PREMISES EQUIPMENT - CPE @xoreipeip
  • 9. • Not gonna mention the ISP’s name • Huge ISP in Europe, it has subsidiaries at least in 8 EU countries • Distributed to more than 6 million customers around Europe (based on the ISP’s website) • Mostly covered by the following devices TODAY’S DEVICE @xoreipeip
  • 11. CISCO EPC3925 - PWNED @xoreipeip
  • 13. TECHNICOLOR TC7200 - PWNED Nice walk-through by Peter Geissler (@bl4sty) on Hack in The box Amsterdam: http://bit.ly/215GwaN @xoreipeip
  • 14. TECHNICOLOR TC7200 - PWNED • Blasty dumped the memory • Reverse engineered the ESSID and WPA2-PSK generator • PSK generator based on ESSID: http://bit.ly/1UnMvTT (TC7200 only) Long story short: @xoreipeip
  • 15. UBEE EVW3226 - PWNED?? @xoreipeip
  • 16. UBEE EVW3226 - PWNED?? • People started to play seriously with the device around January of 2016 • 0day exploit released (physical access needed) - did not work for me • Flash content was dumped and uploaded in the same month • SEC Consult identified overlapping vulns: http://bit.ly/25KdjFK • Yolosec released a tool as well: http://bit.ly/29isodH @xoreipeip
  • 17. THE PLAN • GOAL 0: get the dump of the filesystem • GOAL 1: get full access to the device • GOAL 2: get unauthenticated command/code execution • GOAL 3: get access to the network • … • Profit @xoreipeip
  • 18. GOAL 1: GET FULL ACCESS TO THE DEVICE • Blackbox approach did not succeed • Filesystem dump was released • Device is using lighttpd with a custom .cgi binary • Fired up IDA Pro to look for injection points @xoreipeip
  • 19. JUST A FEW TO MENTION @xoreipeip
  • 20. JUST A FEW TO MENTION @xoreipeip
  • 21. JUST A FEW TO MENTION @xoreipeip
  • 22. CAN YOU SPOT IT? @xoreipeip
  • 24. EXPLOITATION • The code can be invoked by starting a certain feature of the device • Two injection points • ESSID: max 32 ASCII character - although does not accept everything • PSK: max 64 ASCII character - accepts all necessary characters • Admin must be authenticated and connected to the internal network @xoreipeip
  • 26. GOAL 2: FIND UNAUTHENTICATED RCE/BOF • Although we have full access to the device, we still need an admin user to exploit it • Authentication bypass can be a solution • Unauthenticated RCE or BOF can help too @xoreipeip
  • 27. CAN YOU SPOT IT? @xoreipeip
  • 28. VANILLA STACK OVERFLOW Pros: • Unauthenticated like I wished for • Trivial? vanilla stack overflow
 Cons: • Big endian Linux on ARM - no public shell code • No experience with ARM • No qemu-system for big endian ARM, only qemu-user @xoreipeip
  • 29. SHELLCODING • Compiling big endian toolchain with Buildroot • Compiling static gdbserver for the device • Debugging the binary for exploitation • Writing shellcode based on tutorials and others • Linux ARM big endian bind shell code merged into Metasploit
 https://github.com/rapid7/metasploit-framework/pull/6959 @xoreipeip
  • 30. IN THE GDBSERVER • No next or nexti, must put breakpoints on every instruction • Most of the features are gone • stack is not executable - no features, did not check… • turns off stack randomisation (not vanilla anymore) - had to write ROP • turns off ASLR (infoleak needed) @xoreipeip
  • 31. EPIC FAIL • Only 11bit is randomised, 1/2048 chance to hit the address • Webserver forked the process, new memory address every time • Watchdog restarts the web server • Then realised that lighttpd filters most of the characters -> unexploitable @xoreipeip
  • 32. AUTHENTICATION BYPASS • Found by Search-lab • Makes authenticated RCE to unauthenticated • http://www.search-lab.hu/advisories/122-ubee-evw3226- modem-router-multiple-vulnerabilities @xoreipeip
  • 33. GOAL 3: GET ACCESS TO THE NETWORK • Fallback options: • admin:admin account still could work in default cases • previously generated backup can be downloaded • We only need access to the internal network to get full access • Let’s dig the binaries @xoreipeip
  • 34. BACK OF THE BLACKBOX @xoreipeip
  • 35. FEW SYMBOLS FROM THE BINARIES Some of these could be interesting @xoreipeip
  • 37. WPA2-PSK, SSID, WPS PIN GENERATION ALGORITHM • Based only on MAC address, nothing else • Depends on whether it is 5G or 2.4G • MAC can be sniffed • WPS-PIN generation is based on the same idea • Algorithm released 3rd of July by Yolosec @xoreipeip
  • 38. SURPRISE SURPRISE! WPS-PIN ENABLED BY DEFAULT @xoreipeip
  • 39. GETTING INTO THE NETWORK • What if the user changed the SSID? @xoreipeip
  • 40. GETTING INTO THE NETWORK • If the user changed the SSID: you can still get the passphrase @xoreipeip
  • 41. GETTING INTO THE NETWORK • If the user changed the SSID: you can still get the passphrase • What if the user changed the PSK? @xoreipeip
  • 42. GETTING INTO THE NETWORK • If the user changed the SSID: you can still get the passphrase • If the user changed the PSK: let’s generate the WPS-PIN • All of these can be generated from the MAC address • From nothing to root in 2 minutes (default credentials) @xoreipeip
  • 44. THE VENDOR HELPS YOU it’s easier when you have a map - blue dots are the modems @xoreipeip
  • 45. Authenticated firmware upgrade^W^W^W buffer overflow WHO NEEDS MORE? @xoreipeip
  • 46. and if you are too lazy to crack a password… WHO NEEDS MORE? @xoreipeip
  • 47. and if you are too lazy to crack a password… WHO NEEDS MORE? @xoreipeip
  • 48. FURTHER VULNERABILITIES • Previously requested backup can be downloaded without authentication • Plaintext passwords all over the device (nvram, heap, configs) • Backdoor users in passwd and shadow files • Command injections and buffer overflows @xoreipeip
  • 49. IMPACT • Few million customer is potentially vulnerable • Anybody can access their network, get root in a few minutes • Botnets, jump hosts, tor gateways, etc. • Newest Snowden leaks: secret services use MiTM on routers • You cannot be sure that you don’t have a device like this at home ! ! @xoreipeip
  • 50. Balazs Bucsay - @xoreipeip Thank you for your attention! ! Q&A