SlideShare a Scribd company logo
1 of 24
Download to read offline
SSRF exploitation.
Workshop
Special for DefCon-UA
08/12/2012 Moscow, Neuron Hackspace
SSRF - Server Side Request Forgery
● The ability to create requests from the
  vulnerable server to intra/internet
● Using a protocol supported by available URI
  schemas, you can communicate with
  services running on other protocols
  (smuggling)
SSRF - Server Side Request Forgery
● What i can do with forged requests?
● Anything!
  ○ Get data from internal network!
  ○ Exploit all host-based auth!
  ○ Exploit local services at loopback
    interface!
  ○ etc...
SSRF - Server Side Request Forgery
                                    Forged
                     Access to
                                    request
                     loopback
                     interface




    Access to
    internal
    network                                                   HTTP                 HTTP
                                         API
                                         request              request              request
                                                   Frontend             Firewall
                          Backend

                Forged
                request

     Intranet
SSRF - reasons
● SSRF not a vulnerability
● SSRF is class of attacks
● XXE,RFI,CRLF injection and others is SSRF's
  friends
● Anything that can open socket can be
  SSRFed
SSRF - reasons
● Direct writing to sockets in webapp
● HTTP clients (libcurl, LWP, Java:URL, etc)
● Databases functions
● Format processing
  ○ XML parsers (XXE, DTD, XSD, XSLT, etc)
  ○ OpenOffice (DDE, dynamic data, etc)
  ○ PDF (tcpdf library, etc)
SSRF - what stuff needed?

● Desire
● Luck
● Ability to anticipate and assume
● nc (nc -l -vv -p 12345 )
● SSRF cheatsheet doc
SSRF - cheatsheet

● We collected all related information about
  SSRF and their exploitation in one
  cheatsheet:
https://docs.google.
com/document/d/1v1TkWZtrhzRLy0bYXBcdL
UedXGb9njTNIJXa3u9akHM/edit
HTTP clients bugs
Bypass webapp filters i.e. preg_replace using
redirect
● any host -> localhost
● valid port -> any port
● valid schema -> any schema
● SOP for browsers, not for HTTPClients
CASE #1. Market & Payment system.
OAuth token hijacking
● Application received OAuth token from
  payment server
● Token added to HTTP request created by
  libcurl CURLOPT_HTTPHEADER
● This header will be append to all requests
  sended by libcurl. Even after redirects ;)
CASE #1. Market & Payment system.
OAuth token hijacking
● Find a open redirect vuln (WASC-38) at
  payment server
● Change payment url to call redirect instead
  of valid payment transaction
● Jack a OAuth token from market to
  payment system ;)
https://dev.onsec.ru/workshop/market/
CASE #1. Market & Payment system.
OAuth token hijacking
  Open                       SSRF
  redirect                   attack
  vuln



                       HTTP
                       request                  HTTP
                       with                     request
             Payment
                       OAuth          Market
             system
                       token


                                                          OAuth
                                                          token
                                                          from
                                                          market

                                      HTTP
                                      request
                                      with
                                      OAuth
                                      token                   Evil host
Let's go to server-side exploitations
● SSRF really cool for exploit host-based auth

● Host based auth must die ;)

● NoSQL databases, monitoring services and

  much more provide privileges to loopback

  connections by default
Protocol smuggling
● When you say "GET / HTTP/1.1", what hears
  a service?
● When you receive data by one of
  prehistoric protocols what TCP packet you
  send?
● When you say "bla[valid packet]bla", what
  hears a service?
Protocols and URI schemas in HTTP
clients
● gopher:// provide you to create almost any
  TCP packet (no 0x00 for cURL, no bytes
  greater than 0x7f for Java)
● dict:// provide you to forge second line in
  plaint/text request (cURL only)
● ldap:// provide you to forge request with
  constant prefix (LWP only)
What things do smuggling possible?
●   HTTP clients don't check a protocol but
    send data immediately after connect
    (ldap for LWP)
●   Services do not close socket after receive
    invalid packet
●   Protocol that you can forge fits within the
    protocols that you want to exploit
CASE #2. Wordpress exploitation
● Yes, it is latest wordpress (3.4.2) without
  any plugins
● Reason - libcurl unsafe redirect
● But SSRF can be triggered only from admin
  panel
● Use old our friend CSRF!
● CSRF + SSRF make you happy ;)
CASE #2. Wordpress exploitation
● No gopher:// protocol in Debian squeeze
  for cURL
● But dict:// available and provide us to
  exploit memcached
● CSRF + SSRF = memcached exploit ;)
https://dev.onsec.ru/workshop/wordpress/
Format processors are SSRF friends
● 23/03/2012 in Kyiv I told about XXE based
    SSRF
● XML parsers, DTD, XSD, XSLT - all of them
    provide SSRF
● OpenOffice provide SSRF
● Many processing libraries provide SSRF
●   Anything that can open socket can be
    SSRFed
CASE #3. TCPDF library SSRF
● http://www.tcpdf.org/
● Very common library for PDF conversion
● Example application convert users HTML to
  PDF
● What about external resources such as
  images?
● TCPDF using cURL
https://dev.onsec.ru/workshop/pdfconv/
CASE #4. LWP avatars uploader

● LWP - libwww Perl
● Usefully and common library
● Provide unsafe redirect ;)
● Support gopher protocol by default ;)
● Lets go!!!
CASE #4. LWP avatars uploader
Zabbix agentd explotation
● Zabbix is common monitoring system
● Zabbix agentd - local daemon for various
  check
● Host-based auth ;)
● Support command execution ;)
https://dev.onsec.ru/workshop/avatars/
CASE #5. Have a free time?
● Let's go Postgres explotation
● dblink() function provide us to do SSRF
  through SQLi
http://www.postgresql.org/docs/8.
4/static/dblink.html
SELECT dblink_send_query('host=127.0.0.1
dbname=quit user='nstatsn' port=11211
sslmode=disable','select 1');
???
@ONsec_Lab
@d0znpp

d0znpp@onsec.ru

More Related Content

What's hot

HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)
HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)
HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)
Marco Balduzzi
 

What's hot (20)

Cross site scripting
Cross site scriptingCross site scripting
Cross site scripting
 
HTTP HOST header attacks
HTTP HOST header attacksHTTP HOST header attacks
HTTP HOST header attacks
 
The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016
The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016
The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016
 
Introduction to path traversal attack
Introduction to path traversal attackIntroduction to path traversal attack
Introduction to path traversal attack
 
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
 
OWASP Top 10 2021 Presentation (Jul 2022)
OWASP Top 10 2021 Presentation (Jul 2022)OWASP Top 10 2021 Presentation (Jul 2022)
OWASP Top 10 2021 Presentation (Jul 2022)
 
Offzone | Another waf bypass
Offzone | Another waf bypassOffzone | Another waf bypass
Offzone | Another waf bypass
 
Api security-testing
Api security-testingApi security-testing
Api security-testing
 
Deep understanding on Cross-Site Scripting and SQL Injection
Deep understanding on Cross-Site Scripting and SQL InjectionDeep understanding on Cross-Site Scripting and SQL Injection
Deep understanding on Cross-Site Scripting and SQL Injection
 
Waf bypassing Techniques
Waf bypassing TechniquesWaf bypassing Techniques
Waf bypassing Techniques
 
HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)
HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)
HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)
 
Web Cache Poisoning
Web Cache PoisoningWeb Cache Poisoning
Web Cache Poisoning
 
Getting Started with API Security Testing
Getting Started with API Security TestingGetting Started with API Security Testing
Getting Started with API Security Testing
 
Attacking thru HTTP Host header
Attacking thru HTTP Host headerAttacking thru HTTP Host header
Attacking thru HTTP Host header
 
CSRF Attack and Its Prevention technique in ASP.NET MVC
CSRF Attack and Its Prevention technique in ASP.NET MVCCSRF Attack and Its Prevention technique in ASP.NET MVC
CSRF Attack and Its Prevention technique in ASP.NET MVC
 
Pentesting Rest API's by :- Gaurang Bhatnagar
Pentesting Rest API's by :- Gaurang BhatnagarPentesting Rest API's by :- Gaurang Bhatnagar
Pentesting Rest API's by :- Gaurang Bhatnagar
 
Secure Code Warrior - Remote file inclusion
Secure Code Warrior - Remote file inclusionSecure Code Warrior - Remote file inclusion
Secure Code Warrior - Remote file inclusion
 
Directory Traversal & File Inclusion Attacks
Directory Traversal & File Inclusion AttacksDirectory Traversal & File Inclusion Attacks
Directory Traversal & File Inclusion Attacks
 
Cross Site Scripting: Prevention and Detection(XSS)
Cross Site Scripting: Prevention and Detection(XSS)Cross Site Scripting: Prevention and Detection(XSS)
Cross Site Scripting: Prevention and Detection(XSS)
 
Cross site scripting
Cross site scriptingCross site scripting
Cross site scripting
 

Viewers also liked

Known XML Vulnerabilities Are Still a Threat to Popular Parsers ! & Open Sour...
Known XML Vulnerabilities Are Still a Threat to Popular Parsers ! & Open Sour...Known XML Vulnerabilities Are Still a Threat to Popular Parsers ! & Open Sour...
Known XML Vulnerabilities Are Still a Threat to Popular Parsers ! & Open Sour...
Lionel Briand
 
Methods to Bypass a Web Application Firewall Eng
Methods to Bypass a Web Application Firewall EngMethods to Bypass a Web Application Firewall Eng
Methods to Bypass a Web Application Firewall Eng
Dmitry Evteev
 
How to-catch-a-chameleon-steven seeley-ruxcon-2012
How to-catch-a-chameleon-steven seeley-ruxcon-2012How to-catch-a-chameleon-steven seeley-ruxcon-2012
How to-catch-a-chameleon-steven seeley-ruxcon-2012
_mr_me
 

Viewers also liked (20)

XXE Exposed: SQLi, XSS, XXE and XEE against Web Services
XXE Exposed: SQLi, XSS, XXE and XEE against Web ServicesXXE Exposed: SQLi, XSS, XXE and XEE against Web Services
XXE Exposed: SQLi, XSS, XXE and XEE against Web Services
 
Known XML Vulnerabilities Are Still a Threat to Popular Parsers ! & Open Sour...
Known XML Vulnerabilities Are Still a Threat to Popular Parsers ! & Open Sour...Known XML Vulnerabilities Are Still a Threat to Popular Parsers ! & Open Sour...
Known XML Vulnerabilities Are Still a Threat to Popular Parsers ! & Open Sour...
 
SSRF vs. Business-critical applications. XXE tunneling in SAP
SSRF vs. Business-critical applications. XXE tunneling in SAPSSRF vs. Business-critical applications. XXE tunneling in SAP
SSRF vs. Business-critical applications. XXE tunneling in SAP
 
XML Attack Surface - Pierre Ernst (OWASP Ottawa)
XML Attack Surface - Pierre Ernst (OWASP Ottawa)XML Attack Surface - Pierre Ernst (OWASP Ottawa)
XML Attack Surface - Pierre Ernst (OWASP Ottawa)
 
XML & XPath Injections
XML & XPath InjectionsXML & XPath Injections
XML & XPath Injections
 
Bypass file upload restrictions
Bypass file upload restrictionsBypass file upload restrictions
Bypass file upload restrictions
 
Xml external entities [xxe]
Xml external entities [xxe]Xml external entities [xxe]
Xml external entities [xxe]
 
Black Hat: XML Out-Of-Band Data Retrieval
Black Hat: XML Out-Of-Band Data RetrievalBlack Hat: XML Out-Of-Band Data Retrieval
Black Hat: XML Out-Of-Band Data Retrieval
 
External XML Entities
External XML EntitiesExternal XML Entities
External XML Entities
 
No locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructureNo locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructure
 
Methods to Bypass a Web Application Firewall Eng
Methods to Bypass a Web Application Firewall EngMethods to Bypass a Web Application Firewall Eng
Methods to Bypass a Web Application Firewall Eng
 
Web Application Firewalls Detection, Bypassing And Exploitation
Web Application Firewalls  Detection, Bypassing And ExploitationWeb Application Firewalls  Detection, Bypassing And Exploitation
Web Application Firewalls Detection, Bypassing And Exploitation
 
Owasp AppSecEU 2015 - BeEF Session
Owasp AppSecEU 2015 - BeEF SessionOwasp AppSecEU 2015 - BeEF Session
Owasp AppSecEU 2015 - BeEF Session
 
How to-catch-a-chameleon-steven seeley-ruxcon-2012
How to-catch-a-chameleon-steven seeley-ruxcon-2012How to-catch-a-chameleon-steven seeley-ruxcon-2012
How to-catch-a-chameleon-steven seeley-ruxcon-2012
 
Final lfh presentation (3)
Final lfh presentation (3)Final lfh presentation (3)
Final lfh presentation (3)
 
Jon Gorenflo - Burp Collaborator
Jon Gorenflo - Burp CollaboratorJon Gorenflo - Burp Collaborator
Jon Gorenflo - Burp Collaborator
 
D2 t2 steven seeley - ghost in the windows 7 allocator
D2 t2   steven seeley - ghost in the windows 7 allocatorD2 t2   steven seeley - ghost in the windows 7 allocator
D2 t2 steven seeley - ghost in the windows 7 allocator
 
CloudFlare vs Incapsula: Round 2
CloudFlare vs Incapsula: Round 2CloudFlare vs Incapsula: Round 2
CloudFlare vs Incapsula: Round 2
 
Advanced SQL Injection
Advanced SQL InjectionAdvanced SQL Injection
Advanced SQL Injection
 
Web-App Remote Code Execution Via Scripting Engines
Web-App Remote Code Execution Via Scripting EnginesWeb-App Remote Code Execution Via Scripting Engines
Web-App Remote Code Execution Via Scripting Engines
 

Similar to SSRF workshop

Building high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftBuilding high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache Thrift
RX-M Enterprises LLC
 
Securing APIs
Securing APIsSecuring APIs
Securing APIs
WSO2
 

Similar to SSRF workshop (20)

Building high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftBuilding high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache Thrift
 
Ws
WsWs
Ws
 
Ch 3: Web Application Technologies
Ch 3: Web Application TechnologiesCh 3: Web Application Technologies
Ch 3: Web Application Technologies
 
Networked APIs with swift
Networked APIs with swiftNetworked APIs with swift
Networked APIs with swift
 
Web technology-guide
Web technology-guideWeb technology-guide
Web technology-guide
 
Distributed Web-Cache using OpenFlow
Distributed Web-Cache using OpenFlowDistributed Web-Cache using OpenFlow
Distributed Web-Cache using OpenFlow
 
Infura survey
Infura surveyInfura survey
Infura survey
 
Websocket
WebsocketWebsocket
Websocket
 
Web sockets - Pentesting
Web sockets - Pentesting Web sockets - Pentesting
Web sockets - Pentesting
 
Introduction to Ethereum
Introduction to EthereumIntroduction to Ethereum
Introduction to Ethereum
 
API SECURITY
API SECURITYAPI SECURITY
API SECURITY
 
Introduction to Backend Engineering
Introduction to Backend EngineeringIntroduction to Backend Engineering
Introduction to Backend Engineering
 
Securing APIs
Securing APIsSecuring APIs
Securing APIs
 
Micro HTTP Server Implemented in C @ COSCUP 2016
Micro HTTP Server Implemented in C @ COSCUP 2016Micro HTTP Server Implemented in C @ COSCUP 2016
Micro HTTP Server Implemented in C @ COSCUP 2016
 
Ftp servlet
Ftp servletFtp servlet
Ftp servlet
 
De la bonne utilisation de OAuth2
De la bonne utilisation de OAuth2 De la bonne utilisation de OAuth2
De la bonne utilisation de OAuth2
 
Build a Micro HTTP Server for Embedded System
Build a Micro HTTP Server for Embedded SystemBuild a Micro HTTP Server for Embedded System
Build a Micro HTTP Server for Embedded System
 
Micro HTTP Server for Embedded
Micro HTTP Server for EmbeddedMicro HTTP Server for Embedded
Micro HTTP Server for Embedded
 
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
 
Building Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using WebsocketsBuilding Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using Websockets
 

More from Ivan Novikov

Data normalization weaknesses
Data normalization weaknessesData normalization weaknesses
Data normalization weaknesses
Ivan Novikov
 
Distributed computing in browsers as client side attack
Distributed computing in browsers as client side attackDistributed computing in browsers as client side attack
Distributed computing in browsers as client side attack
Ivan Novikov
 
Yandex rewards. ONsec experience
Yandex rewards. ONsec experienceYandex rewards. ONsec experience
Yandex rewards. ONsec experience
Ivan Novikov
 

More from Ivan Novikov (7)

How to hack. Cyprus meetup
How to hack. Cyprus meetupHow to hack. Cyprus meetup
How to hack. Cyprus meetup
 
Where is my silver bullet?!
Where is my silver bullet?!Where is my silver bullet?!
Where is my silver bullet?!
 
OpenSSL rands (fork-safe)
OpenSSL rands (fork-safe)OpenSSL rands (fork-safe)
OpenSSL rands (fork-safe)
 
Data normalization weaknesses
Data normalization weaknessesData normalization weaknesses
Data normalization weaknesses
 
Lie to Me: Bypassing Modern Web Application Firewalls
Lie to Me: Bypassing Modern Web Application FirewallsLie to Me: Bypassing Modern Web Application Firewalls
Lie to Me: Bypassing Modern Web Application Firewalls
 
Distributed computing in browsers as client side attack
Distributed computing in browsers as client side attackDistributed computing in browsers as client side attack
Distributed computing in browsers as client side attack
 
Yandex rewards. ONsec experience
Yandex rewards. ONsec experienceYandex rewards. ONsec experience
Yandex rewards. ONsec experience
 

Recently uploaded

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
 
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
 
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@
 
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
 

Recently uploaded (20)

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...
 
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
 
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
 
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...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
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 ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
"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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
+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
 
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
 

SSRF workshop

  • 1. SSRF exploitation. Workshop Special for DefCon-UA 08/12/2012 Moscow, Neuron Hackspace
  • 2. SSRF - Server Side Request Forgery ● The ability to create requests from the vulnerable server to intra/internet ● Using a protocol supported by available URI schemas, you can communicate with services running on other protocols (smuggling)
  • 3. SSRF - Server Side Request Forgery ● What i can do with forged requests? ● Anything! ○ Get data from internal network! ○ Exploit all host-based auth! ○ Exploit local services at loopback interface! ○ etc...
  • 4. SSRF - Server Side Request Forgery Forged Access to request loopback interface Access to internal network HTTP HTTP API request request request Frontend Firewall Backend Forged request Intranet
  • 5. SSRF - reasons ● SSRF not a vulnerability ● SSRF is class of attacks ● XXE,RFI,CRLF injection and others is SSRF's friends ● Anything that can open socket can be SSRFed
  • 6. SSRF - reasons ● Direct writing to sockets in webapp ● HTTP clients (libcurl, LWP, Java:URL, etc) ● Databases functions ● Format processing ○ XML parsers (XXE, DTD, XSD, XSLT, etc) ○ OpenOffice (DDE, dynamic data, etc) ○ PDF (tcpdf library, etc)
  • 7. SSRF - what stuff needed? ● Desire ● Luck ● Ability to anticipate and assume ● nc (nc -l -vv -p 12345 ) ● SSRF cheatsheet doc
  • 8. SSRF - cheatsheet ● We collected all related information about SSRF and their exploitation in one cheatsheet: https://docs.google. com/document/d/1v1TkWZtrhzRLy0bYXBcdL UedXGb9njTNIJXa3u9akHM/edit
  • 9. HTTP clients bugs Bypass webapp filters i.e. preg_replace using redirect ● any host -> localhost ● valid port -> any port ● valid schema -> any schema ● SOP for browsers, not for HTTPClients
  • 10. CASE #1. Market & Payment system. OAuth token hijacking ● Application received OAuth token from payment server ● Token added to HTTP request created by libcurl CURLOPT_HTTPHEADER ● This header will be append to all requests sended by libcurl. Even after redirects ;)
  • 11. CASE #1. Market & Payment system. OAuth token hijacking ● Find a open redirect vuln (WASC-38) at payment server ● Change payment url to call redirect instead of valid payment transaction ● Jack a OAuth token from market to payment system ;) https://dev.onsec.ru/workshop/market/
  • 12. CASE #1. Market & Payment system. OAuth token hijacking Open SSRF redirect attack vuln HTTP request HTTP with request Payment OAuth Market system token OAuth token from market HTTP request with OAuth token Evil host
  • 13. Let's go to server-side exploitations ● SSRF really cool for exploit host-based auth ● Host based auth must die ;) ● NoSQL databases, monitoring services and much more provide privileges to loopback connections by default
  • 14. Protocol smuggling ● When you say "GET / HTTP/1.1", what hears a service? ● When you receive data by one of prehistoric protocols what TCP packet you send? ● When you say "bla[valid packet]bla", what hears a service?
  • 15. Protocols and URI schemas in HTTP clients ● gopher:// provide you to create almost any TCP packet (no 0x00 for cURL, no bytes greater than 0x7f for Java) ● dict:// provide you to forge second line in plaint/text request (cURL only) ● ldap:// provide you to forge request with constant prefix (LWP only)
  • 16. What things do smuggling possible? ● HTTP clients don't check a protocol but send data immediately after connect (ldap for LWP) ● Services do not close socket after receive invalid packet ● Protocol that you can forge fits within the protocols that you want to exploit
  • 17. CASE #2. Wordpress exploitation ● Yes, it is latest wordpress (3.4.2) without any plugins ● Reason - libcurl unsafe redirect ● But SSRF can be triggered only from admin panel ● Use old our friend CSRF! ● CSRF + SSRF make you happy ;)
  • 18. CASE #2. Wordpress exploitation ● No gopher:// protocol in Debian squeeze for cURL ● But dict:// available and provide us to exploit memcached ● CSRF + SSRF = memcached exploit ;) https://dev.onsec.ru/workshop/wordpress/
  • 19. Format processors are SSRF friends ● 23/03/2012 in Kyiv I told about XXE based SSRF ● XML parsers, DTD, XSD, XSLT - all of them provide SSRF ● OpenOffice provide SSRF ● Many processing libraries provide SSRF ● Anything that can open socket can be SSRFed
  • 20. CASE #3. TCPDF library SSRF ● http://www.tcpdf.org/ ● Very common library for PDF conversion ● Example application convert users HTML to PDF ● What about external resources such as images? ● TCPDF using cURL https://dev.onsec.ru/workshop/pdfconv/
  • 21. CASE #4. LWP avatars uploader ● LWP - libwww Perl ● Usefully and common library ● Provide unsafe redirect ;) ● Support gopher protocol by default ;) ● Lets go!!!
  • 22. CASE #4. LWP avatars uploader Zabbix agentd explotation ● Zabbix is common monitoring system ● Zabbix agentd - local daemon for various check ● Host-based auth ;) ● Support command execution ;) https://dev.onsec.ru/workshop/avatars/
  • 23. CASE #5. Have a free time? ● Let's go Postgres explotation ● dblink() function provide us to do SSRF through SQLi http://www.postgresql.org/docs/8. 4/static/dblink.html SELECT dblink_send_query('host=127.0.0.1 dbname=quit user='nstatsn' port=11211 sslmode=disable','select 1');