SlideShare une entreprise Scribd logo
1  sur  40
Backup File Artifacts
The Underrated Web Danger
TESTING AND EXPLOITING BFA WITH BFAC
By:
Mazin Ahmed
@mazen160
mazin AT mazinahmed DOT net
WHO AM I?
 Mazin Ahmed
• Freelancing Security Researcher at Bugcrowd, Inc.
• Security Contributor at ProtonMail
• Freelancing Information Security Specialist
• You can read more at https://mazinahmed.net/
WHO AM I?
 And I have contributed to the security of the following:
Table of Contents
 Introduction
 How BFA Occurs?
 Background
 Previous Researches
 Wrapping Ideas Together
 The Problem
 BFA Findings in Real-World.
 Introducing BFAC
 Using BFAC
 Mitigations
 Questions
What is Backup-File Artifacts?
Background
Code Editors
 Code editors makes a backup copy of the files that being edited.
 Mostly, it's being done in the same directory of the file.
 It's made using the same filename.
 It uses predictable patterns.
Background
Code Editors
Product Name Backup Pattern (Assuming the
filename is config.php)
Emacs #config.php#
Nano config.php.save
Vim (swap file) config.php.swp
Vim (swap file) config.php.swo
Vim, Gedit config.php~
Background
Code Editors
The Problem
 Developers mostly forgets to check for Backup File Artifacts caused by code
editors, and underestimate the impact of leaving similar artifacts.
 This would lead to the disclosure of the source code of the script that has
been edited.
Background
Version Control Systems
 Version Control Systems (VCS) are systems made to manage changes on
files, documents, computer programs, code, websites, etc…
 All Version Control Systems has a directory by design that contains data
and/or source-code.
 The directory is made to have a backup of files, and to control the changes
on the files within the project.
 By design, we already know directories names, the important files, and the
directories' structure of source-code version controller systems.
Background
Version Control Systems
Version Control System Pre-known Files and Directories
GIT /.git (Default Directory)
GIT /.gitignore
GIT /.git/index
GIT /.git/HEAD
GIT /.git/refs
Mercurial /.hg (Default Directory)
Mercurial /.hg/requires
Bazaar /.bzr/ (Default Directory)
Bazaar /.bzr/README
Subversion /.svn (Default Directory)
Subversion /.svn/entries
Subversion /.svnignore
Background
Version Control Systems
The Problem
 Companies and developers in many occasions clone or download the
repository into production, and FORGETS TO DELETE THE VCS
DIRECTORIES.
 This would lead to the disclosure of the source code of the company's
application.
 The worst part: many websites don't disable directory listing, which makes exploiting that
like a piece of cake.
Profit?
 downloading the VCS directory would be as simple as:
$ wget --mirror -np –I /[path_to_vcs_dir] http://example.com/[path_to_vcs_dir]
Background
Version Control Systems
The Problem
 In case the website disables directory listing, exploitation is still possible.
Background
Version Control Systems
The Problem
 Exploitation of Missed VCS Folders on Web-Apps When Directory
Listing is Disabled:-
 Simply: Brute-Forcing the VCS structure.
Background
Version Control Systems
The Problem
 Exploitation of Missed VCS Folders on Web-Apps When Directory Listing is
Disabled:-
 There are tools that can do that too:
 GIT-Tools by Internetwache: A collection of scripts that can be used to
retrieved GIT repositories from the web-app, even if directory listing is
disabled. Written in Bash and Python.
 DVCS-Ripper by @kost: A tool that can perform recover different repositories
even if directory listing is disabled. Written in Perl.
 DVCS-Pillage by Adam Baldwin: A tool that extracts and retrieves different
DVCS repositories.
Background
Version Control Systems
The Problem
Background
Human-Based Missed Backup File Artifacts
 Developers usually do a backup before attempting to edit files.
 Example:-
Editing index.php
 Before editing, many developers do the following:
$cp index.php index.php.bak
 Developers in many cases forgets to remove the backup file.
 It may even be left on production.
Background
Human-Based Missed Backup File Artifacts
The Problem
Impact
 An unauthorized attacker can brute-forces through different patterns of
human-based backing up, and check if the file exists and accessible to the
public.
 If succeeded, the unauthorized attacker would be able to view the source-
code of the script (Source-Code Disclosure).
Background
Human-Based Missed Backup File Artifacts
The Problem
Previous Researches
Pillaging DVCS Repos For Fun And Profit - Defcon 19 - Adam Baldwin – 2011
 The talk discusses different leakage of Distributed Version Control Systems,
and how it can leak the website’s source-code and data if it’s incorrectly
accessible by unauthorized users.
 A test on Alexa top 1M was done and showed that roughly 2,000 websites were
vulnerable.
 A tool called DVCS-Pillage was released that helps retrieving repositories from
websites that exposes them.
1% of CMS-Powered Sites Expose Their Database Passwords - Feross
Aboukhadijeh – 2011
 A research that shows how can human-based backup artifacts and backup
artifacts made by code-editors leaks sensitive data on popular CMSs.
 Also, tested Alexa top 200,000 websites for basic BFAs on CMSs
configuration files.
 Results showed a large number of high-profile websites had BFA left on
production.
 Wrote a tool that can detect basic BFAs for CMSs configuration files.
Previous Researches
Don't publicly expose .git or how we downloaded your website's
sourcecode – Internetwache - 2015
 A research done by Internetwache on GIT VCS, and how it can leak web-
applications' source-code and data.
 Demonstrated different techniques for real-world exploitation of missed GIT
repositories on production.
 Tested Alexa top 1M websites for web-applications that left GIT repositories on
production.
 Published a set of scripts to automatically tries to retrieve files from GIT
repositories.
Previous Researches
 Backup-File Artifacts are caused by different ways, mostly, it’s the admin/developer mistake
to allow it accessible.
 Exploitation of Human-Based BFA and BFAs that is caused by code-editors can be done as
the following:
Example:-
Saying that index.php.bak is discovered.
Wrapping Ideas Together
 Having the meta directory of Control Version Systems accessible also
leads to source-code and data disclosure.
Wrapping Ideas Together
Wrapping Ideas Together
Source-Code and Data Disclosure
Human-Based Backup File Artifacts
Backup File Artifacts
Caused by Code Editors
Version Controlling System
Meta Directories
Backup File Artifacts
 Most Open-Source and Commercial Web Vulnerability Scanners DO NOT
PERFORM TESTING FOR BACKUP FILE ARTIFACTS.
 Examples of Tested Open-Source Scanners That Do Not Perform BFA
Checks:-
• OWASP ZAP 2.4
• Vega
• W3AF – There are partial plugins that does basic testing, but it’s disabled
by default.
• Nikto 2.4.6
The Problem
 There are very few current Scanners that performs Backup Artifacts. Testing.
However, those rare scanners only test the very basic pattern of BFA.
 Many Important patterns testing are MISSED!
The Problem
BFA Findings in Real-World
Paypal BFA That Lead to RCE - Ebraheem Hegazy
 Ebraheem found a script called upload.php on a Paypal-owned server.
 wrote script to test for BFA, and to check if the script exist on other
subdomains.
 Found a BFA for upload.php, and transformed the Blackbox testing to
whitebox testing.
 After source-code reviewing it, he found a bug that leads to RCE.
Profit: Got an RCE exploit on a Paypal server. Paypal fixed the issue, and he was
awarded a nice bounty.
BFA Findings in Real-World
ISC.org BFA that Disclosed Database Credentials - Feross Aboukhadijeh
 During Feross’s research, he tested ISC.org for BFA on Wordpress configuration
files, wp-config.php.
 He found a BFA left on the main production site of ISC.org, containing database
credentials.
Profit: The researcher had potentially valid credentials to ISC.org (“potentially” is
said, as the researcher stated that he didn’t use it gain unauthorized access). Feross
reported it to ISC.org, and they have fixed it.
BFA Findings in Real-World
A Collection of BFAs - Mazin Ahmed
 Used BFAC to discover a number of BFA issues on web-applications, mostly for
confidential clients.
 BFA Findings Leads To:
• Credentials leakage.
• Turning testing to whitebox.
• Finding additional security vulnerabilities.
• RCE.
• SQLI.
• XSS.
• Even more BFA issues.
• etc...
 About the Project:
 BFAC (Backup-File Artifacts Checker) is an automated tool that checks for
backup artifacts that may discloses the web-application's source code.
 BFAC goal is to be an all-in-one tool for backup-file artifacts black-box
testing.
Introducing BFAC
 About the Project:
 Code Specifications:-
 Written in pure Python.
 Compatible with both Python2.x and Python3.x.
 Cross-Platform: Works on Linux, Windows, Mac, Android, and IOS.
 Requires a slight amount of resources/modules.
 API friendly.
 Released under GNU GPLv3.0 License.
Introducing BFAC
 About the Project:
 Features:-
 Testing all common types of backup-file artifacts patterns, including human-based
BFAs, and BFA that can occur via code-editors.
 Includes tests for common VCS artifacts, such as GIT, Subversion, Mercurial, and
Bazaar.
 Smart detection techniques: Capable of detecting "Not Found", and valid pages using
different tests.
 Stealthy Interaction with Web Servers.
 Easy to edit and customize based on needs; easy to add custom BFA patterns.
 Dynamic and generic; made to be not specified to test a specific environment or server.
Downloading BFAC
BFAC
https://github.com/mazen160/bfac
Downloading and Installing BFAC
 Cloning BFAC
$ git clone https://github.com/mazen160/bfac.git
 Installing BFAC ( for *NIX machines)
As simple as:
$ python install.py confirm
Using BFAC
 Performs basic tests on the link, showing all attempts, and using random user-agents on
each request.
$ bfac --url 'http://example.com/test.php' --verbose --random-agent
 Ignore 500 and 503 HTTP response codes when is detected as findings.
$ bfac --url 'http://example.com/test.php' --verbose --exclude-
status-codes 500,503
Using BFAC
 Default option to confirm the existence of the BFA is set to check
both of the HTTP Status Codes and the Content Length (set to
“both”).
 Rely only on HTTP Status Codes for confirming the existence of the BFA.
$ bfac --url 'http://example.com/test.php' --verbose --verify-file-
availability status_code
 Rely only on Content Length measures in order to confirm the existence of the BFA.
$ bfac --url 'http://example.com/test.php' --verbose --verify-file-
availability content_length
Using BFAC
 Perform BFA testing for all current testing levels (Level 4 includes tests from all below
levels).
$ bfac --url 'http://example.com/test.php' --verbose --level 4
 Print a clean output with only findings, separated by newlines. Suitable for APIs and
integration with other tools.
$ bfac --url 'http://example.com/test.php' --no-text --level 4
Mitigation
Developer-Level:-
 Awareness
 Probably the only reliable solution.
 Developers' behavior regarding actions on production-level and publicly accessible
applications are the main reason for this vulnerability type to occur.
Software-Level:-
 Access rules seems to be useful in blocking some of the patterns. However, it does not
protect as needed.
Questions?
Mazin Ahmed
Twitter: @mazen160
Email: mazin AT mazinahmed DOT net
Website: https://mazinahmed.net
LinkedIn: https://linkedin.com/in/infosecmazinahmed

Contenu connexe

Tendances

Tendances (20)

Bug Bounty 101
Bug Bounty 101Bug Bounty 101
Bug Bounty 101
 
Basics of getting Into Bug Bounty Hunting
Basics of getting Into Bug Bounty HuntingBasics of getting Into Bug Bounty Hunting
Basics of getting Into Bug Bounty Hunting
 
How to steal and modify data using Business Logic flaws - Insecure Direct Obj...
How to steal and modify data using Business Logic flaws - Insecure Direct Obj...How to steal and modify data using Business Logic flaws - Insecure Direct Obj...
How to steal and modify data using Business Logic flaws - Insecure Direct Obj...
 
Overview of information security
Overview of information securityOverview of information security
Overview of information security
 
Bug bounty
Bug bountyBug bounty
Bug bounty
 
Kludges and PHP. Why Should You Use a WAF?
Kludges and PHP. Why Should You Use a WAF?Kludges and PHP. Why Should You Use a WAF?
Kludges and PHP. Why Should You Use a WAF?
 
Hijacking Softwares for fun and profit
Hijacking Softwares for fun and profitHijacking Softwares for fun and profit
Hijacking Softwares for fun and profit
 
CMS Hacking Tricks - DerbyCon 4 - 2014
CMS Hacking Tricks - DerbyCon 4 - 2014CMS Hacking Tricks - DerbyCon 4 - 2014
CMS Hacking Tricks - DerbyCon 4 - 2014
 
Bug Bounty for - Beginners
Bug Bounty for - BeginnersBug Bounty for - Beginners
Bug Bounty for - Beginners
 
ACRNA Webinar #5: Cyber Security – The Unlikely Romance
ACRNA Webinar #5: Cyber Security – The Unlikely RomanceACRNA Webinar #5: Cyber Security – The Unlikely Romance
ACRNA Webinar #5: Cyber Security – The Unlikely Romance
 
Security by Weston Hecker
Security by Weston HeckerSecurity by Weston Hecker
Security by Weston Hecker
 
Hacking Web Apps by Brent White
Hacking Web Apps by Brent WhiteHacking Web Apps by Brent White
Hacking Web Apps by Brent White
 
Empire Work shop
Empire Work shopEmpire Work shop
Empire Work shop
 
REST API Pentester's perspective
REST API Pentester's perspectiveREST API Pentester's perspective
REST API Pentester's perspective
 
Wi-Fi Hotspot Attacks
Wi-Fi Hotspot AttacksWi-Fi Hotspot Attacks
Wi-Fi Hotspot Attacks
 
Bug bounties - cén scéal?
Bug bounties - cén scéal?Bug bounties - cén scéal?
Bug bounties - cén scéal?
 
Bug bounty or beg bounty?
Bug bounty or beg bounty?Bug bounty or beg bounty?
Bug bounty or beg bounty?
 
Tale of Forgotten Disclosure and Lesson learned
Tale of Forgotten Disclosure and Lesson learnedTale of Forgotten Disclosure and Lesson learned
Tale of Forgotten Disclosure and Lesson learned
 
Testing iOS apps without jailbreak in 2018
Testing iOS apps without jailbreak in 2018Testing iOS apps without jailbreak in 2018
Testing iOS apps without jailbreak in 2018
 
Beyond Ethical Hacking By Nipun Jaswal , CSA HCF Infosec Pvt. Ltd
Beyond Ethical Hacking By Nipun Jaswal , CSA HCF Infosec Pvt. LtdBeyond Ethical Hacking By Nipun Jaswal , CSA HCF Infosec Pvt. Ltd
Beyond Ethical Hacking By Nipun Jaswal , CSA HCF Infosec Pvt. Ltd
 

En vedette

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
 
Cloud computing security policy framework for mitigating denial of service at...
Cloud computing security policy framework for mitigating denial of service at...Cloud computing security policy framework for mitigating denial of service at...
Cloud computing security policy framework for mitigating denial of service at...
Venkatesh Prabhu
 
A New Form of Dos attack in Cloud
A New Form of Dos attack in CloudA New Form of Dos attack in Cloud
A New Form of Dos attack in Cloud
Sanoj Kumar
 

En vedette (20)

Pentru tine
Pentru tinePentru tine
Pentru tine
 
600.412.Lecture02
600.412.Lecture02600.412.Lecture02
600.412.Lecture02
 
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)
 
ОО" Шоола Кол" презентация Результаты поиска Санкт-Петербург 14 октября
ОО" Шоола Кол" презентация  Результаты поиска Санкт-Петербург  14 октябряОО" Шоола Кол" презентация  Результаты поиска Санкт-Петербург  14 октября
ОО" Шоола Кол" презентация Результаты поиска Санкт-Петербург 14 октября
 
Cctk support for setting hdd password
Cctk support for setting hdd passwordCctk support for setting hdd password
Cctk support for setting hdd password
 
Softworx Enterprise Asset Management 101 - Presentation Template
Softworx Enterprise Asset Management 101 - Presentation TemplateSoftworx Enterprise Asset Management 101 - Presentation Template
Softworx Enterprise Asset Management 101 - Presentation Template
 
Cloud computing security policy framework for mitigating denial of service at...
Cloud computing security policy framework for mitigating denial of service at...Cloud computing security policy framework for mitigating denial of service at...
Cloud computing security policy framework for mitigating denial of service at...
 
чынгыз айтматов Small
чынгыз айтматов Smallчынгыз айтматов Small
чынгыз айтматов Small
 
Avian flu Type A-H5N1 epidemiological model: Puerto Rico as a case study
Avian flu Type A-H5N1 epidemiological model: Puerto Rico as a case studyAvian flu Type A-H5N1 epidemiological model: Puerto Rico as a case study
Avian flu Type A-H5N1 epidemiological model: Puerto Rico as a case study
 
Presentation1
Presentation1Presentation1
Presentation1
 
Why AIS is not always enough
Why AIS is not always enoughWhy AIS is not always enough
Why AIS is not always enough
 
Christmas
ChristmasChristmas
Christmas
 
Cybercrime in the Deep Web (BHEU 2015)
Cybercrime in the Deep Web (BHEU 2015)Cybercrime in the Deep Web (BHEU 2015)
Cybercrime in the Deep Web (BHEU 2015)
 
Personal informatic
Personal informaticPersonal informatic
Personal informatic
 
Family tree
Family treeFamily tree
Family tree
 
HITB2012AMS - SatanCloud: A Journey Into the Privacy and Security Risks of Cl...
HITB2012AMS - SatanCloud: A Journey Into the Privacy and Security Risks of Cl...HITB2012AMS - SatanCloud: A Journey Into the Privacy and Security Risks of Cl...
HITB2012AMS - SatanCloud: A Journey Into the Privacy and Security Risks of Cl...
 
A New Form of Dos attack in Cloud
A New Form of Dos attack in CloudA New Form of Dos attack in Cloud
A New Form of Dos attack in Cloud
 
HTTP(S)-Based Clustering for Assisted Cybercrime Investigations
 HTTP(S)-Based Clustering for Assisted Cybercrime Investigations HTTP(S)-Based Clustering for Assisted Cybercrime Investigations
HTTP(S)-Based Clustering for Assisted Cybercrime Investigations
 
Possessive adjectives
Possessive adjectivesPossessive adjectives
Possessive adjectives
 
AIS Exposed. New vulnerabilities and attacks. (HITB AMS 2014)
AIS Exposed. New vulnerabilities and attacks. (HITB AMS 2014)AIS Exposed. New vulnerabilities and attacks. (HITB AMS 2014)
AIS Exposed. New vulnerabilities and attacks. (HITB AMS 2014)
 

Similaire à Backup-File Artifacts - OWASP Khartoum InfoSec Sessions 2016 - Mazin Ahmed

20+ ways to bypass your mac os privacy mechanisms
20+ ways to bypass your mac os privacy mechanisms20+ ways to bypass your mac os privacy mechanisms
20+ ways to bypass your mac os privacy mechanisms
Csaba Fitzl
 
20+ Ways to Bypass Your macOS Privacy Mechanisms
20+ Ways to Bypass Your macOS Privacy Mechanisms20+ Ways to Bypass Your macOS Privacy Mechanisms
20+ Ways to Bypass Your macOS Privacy Mechanisms
SecuRing
 
TakeDownCon Rocket City: WebShells by Adrian Crenshaw
TakeDownCon Rocket City: WebShells by Adrian CrenshawTakeDownCon Rocket City: WebShells by Adrian Crenshaw
TakeDownCon Rocket City: WebShells by Adrian Crenshaw
EC-Council
 

Similaire à Backup-File Artifacts - OWASP Khartoum InfoSec Sessions 2016 - Mazin Ahmed (20)

Effectiveness of AV in Detecting Web Application Backdoors
Effectiveness of AV in Detecting Web Application BackdoorsEffectiveness of AV in Detecting Web Application Backdoors
Effectiveness of AV in Detecting Web Application Backdoors
 
Vulners: Google for hackers
Vulners: Google for hackersVulners: Google for hackers
Vulners: Google for hackers
 
20+ ways to bypass your mac os privacy mechanisms
20+ ways to bypass your mac os privacy mechanisms20+ ways to bypass your mac os privacy mechanisms
20+ ways to bypass your mac os privacy mechanisms
 
Containerizing legacy applications
Containerizing legacy applicationsContainerizing legacy applications
Containerizing legacy applications
 
Evilgrade Defcon 18 2010
Evilgrade Defcon 18 2010Evilgrade Defcon 18 2010
Evilgrade Defcon 18 2010
 
20+ Ways to Bypass Your macOS Privacy Mechanisms
20+ Ways to Bypass Your macOS Privacy Mechanisms20+ Ways to Bypass Your macOS Privacy Mechanisms
20+ Ways to Bypass Your macOS Privacy Mechanisms
 
Wordpress Security & Hardening Steps
Wordpress Security & Hardening StepsWordpress Security & Hardening Steps
Wordpress Security & Hardening Steps
 
DEF CON 27 - workshop - RYAN CHAPMAN - understanding and analyzing weaponized...
DEF CON 27 - workshop - RYAN CHAPMAN - understanding and analyzing weaponized...DEF CON 27 - workshop - RYAN CHAPMAN - understanding and analyzing weaponized...
DEF CON 27 - workshop - RYAN CHAPMAN - understanding and analyzing weaponized...
 
Version Control for mere and freelance mortals
Version Control for mere and freelance mortalsVersion Control for mere and freelance mortals
Version Control for mere and freelance mortals
 
Rapidly prototyping web applications using BackPress
Rapidly prototyping web applications using BackPressRapidly prototyping web applications using BackPress
Rapidly prototyping web applications using BackPress
 
TakeDownCon Rocket City: WebShells by Adrian Crenshaw
TakeDownCon Rocket City: WebShells by Adrian CrenshawTakeDownCon Rocket City: WebShells by Adrian Crenshaw
TakeDownCon Rocket City: WebShells by Adrian Crenshaw
 
BlackHat 2014 Briefings - Exploiting Fundamental Weaknesses in Botnet C&C Pan...
BlackHat 2014 Briefings - Exploiting Fundamental Weaknesses in Botnet C&C Pan...BlackHat 2014 Briefings - Exploiting Fundamental Weaknesses in Botnet C&C Pan...
BlackHat 2014 Briefings - Exploiting Fundamental Weaknesses in Botnet C&C Pan...
 
Web application security
Web application securityWeb application security
Web application security
 
How to debug IoT Agents
How to debug IoT AgentsHow to debug IoT Agents
How to debug IoT Agents
 
Two-For-One Talk: Malware Analysis for Everyone
Two-For-One Talk: Malware Analysis for EveryoneTwo-For-One Talk: Malware Analysis for Everyone
Two-For-One Talk: Malware Analysis for Everyone
 
Malicious file upload attacks - a case study
Malicious file upload attacks - a case studyMalicious file upload attacks - a case study
Malicious file upload attacks - a case study
 
Building & Leveraging White Database for Antivirus Testing
Building & Leveraging White Database for Antivirus TestingBuilding & Leveraging White Database for Antivirus Testing
Building & Leveraging White Database for Antivirus Testing
 
Windows container security
Windows container securityWindows container security
Windows container security
 
"15 Technique to Exploit File Upload Pages", Ebrahim Hegazy
"15 Technique to Exploit File Upload Pages", Ebrahim Hegazy"15 Technique to Exploit File Upload Pages", Ebrahim Hegazy
"15 Technique to Exploit File Upload Pages", Ebrahim Hegazy
 
What is the Secure Supply Chain and the Current State of the PHP Ecosystem
What is the Secure Supply Chain and the Current State of the PHP EcosystemWhat is the Secure Supply Chain and the Current State of the PHP Ecosystem
What is the Secure Supply Chain and the Current State of the PHP Ecosystem
 

Dernier

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

Dernier (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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...
 
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?
 
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...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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
 
+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...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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
 
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
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
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
 

Backup-File Artifacts - OWASP Khartoum InfoSec Sessions 2016 - Mazin Ahmed

  • 1. Backup File Artifacts The Underrated Web Danger TESTING AND EXPLOITING BFA WITH BFAC By: Mazin Ahmed @mazen160 mazin AT mazinahmed DOT net
  • 2. WHO AM I?  Mazin Ahmed • Freelancing Security Researcher at Bugcrowd, Inc. • Security Contributor at ProtonMail • Freelancing Information Security Specialist • You can read more at https://mazinahmed.net/
  • 3. WHO AM I?  And I have contributed to the security of the following:
  • 4. Table of Contents  Introduction  How BFA Occurs?  Background  Previous Researches  Wrapping Ideas Together  The Problem  BFA Findings in Real-World.  Introducing BFAC  Using BFAC  Mitigations  Questions
  • 5. What is Backup-File Artifacts?
  • 6. Background Code Editors  Code editors makes a backup copy of the files that being edited.  Mostly, it's being done in the same directory of the file.  It's made using the same filename.  It uses predictable patterns.
  • 7. Background Code Editors Product Name Backup Pattern (Assuming the filename is config.php) Emacs #config.php# Nano config.php.save Vim (swap file) config.php.swp Vim (swap file) config.php.swo Vim, Gedit config.php~
  • 8. Background Code Editors The Problem  Developers mostly forgets to check for Backup File Artifacts caused by code editors, and underestimate the impact of leaving similar artifacts.  This would lead to the disclosure of the source code of the script that has been edited.
  • 9. Background Version Control Systems  Version Control Systems (VCS) are systems made to manage changes on files, documents, computer programs, code, websites, etc…  All Version Control Systems has a directory by design that contains data and/or source-code.  The directory is made to have a backup of files, and to control the changes on the files within the project.  By design, we already know directories names, the important files, and the directories' structure of source-code version controller systems.
  • 10. Background Version Control Systems Version Control System Pre-known Files and Directories GIT /.git (Default Directory) GIT /.gitignore GIT /.git/index GIT /.git/HEAD GIT /.git/refs Mercurial /.hg (Default Directory) Mercurial /.hg/requires Bazaar /.bzr/ (Default Directory) Bazaar /.bzr/README Subversion /.svn (Default Directory) Subversion /.svn/entries Subversion /.svnignore
  • 11. Background Version Control Systems The Problem  Companies and developers in many occasions clone or download the repository into production, and FORGETS TO DELETE THE VCS DIRECTORIES.  This would lead to the disclosure of the source code of the company's application.
  • 12.  The worst part: many websites don't disable directory listing, which makes exploiting that like a piece of cake. Profit?  downloading the VCS directory would be as simple as: $ wget --mirror -np –I /[path_to_vcs_dir] http://example.com/[path_to_vcs_dir] Background Version Control Systems The Problem
  • 13.  In case the website disables directory listing, exploitation is still possible. Background Version Control Systems The Problem
  • 14.  Exploitation of Missed VCS Folders on Web-Apps When Directory Listing is Disabled:-  Simply: Brute-Forcing the VCS structure. Background Version Control Systems The Problem
  • 15.  Exploitation of Missed VCS Folders on Web-Apps When Directory Listing is Disabled:-  There are tools that can do that too:  GIT-Tools by Internetwache: A collection of scripts that can be used to retrieved GIT repositories from the web-app, even if directory listing is disabled. Written in Bash and Python.  DVCS-Ripper by @kost: A tool that can perform recover different repositories even if directory listing is disabled. Written in Perl.  DVCS-Pillage by Adam Baldwin: A tool that extracts and retrieves different DVCS repositories. Background Version Control Systems The Problem
  • 16. Background Human-Based Missed Backup File Artifacts  Developers usually do a backup before attempting to edit files.  Example:- Editing index.php  Before editing, many developers do the following: $cp index.php index.php.bak
  • 17.  Developers in many cases forgets to remove the backup file.  It may even be left on production. Background Human-Based Missed Backup File Artifacts The Problem
  • 18. Impact  An unauthorized attacker can brute-forces through different patterns of human-based backing up, and check if the file exists and accessible to the public.  If succeeded, the unauthorized attacker would be able to view the source- code of the script (Source-Code Disclosure). Background Human-Based Missed Backup File Artifacts The Problem
  • 19. Previous Researches Pillaging DVCS Repos For Fun And Profit - Defcon 19 - Adam Baldwin – 2011  The talk discusses different leakage of Distributed Version Control Systems, and how it can leak the website’s source-code and data if it’s incorrectly accessible by unauthorized users.  A test on Alexa top 1M was done and showed that roughly 2,000 websites were vulnerable.  A tool called DVCS-Pillage was released that helps retrieving repositories from websites that exposes them.
  • 20. 1% of CMS-Powered Sites Expose Their Database Passwords - Feross Aboukhadijeh – 2011  A research that shows how can human-based backup artifacts and backup artifacts made by code-editors leaks sensitive data on popular CMSs.  Also, tested Alexa top 200,000 websites for basic BFAs on CMSs configuration files.  Results showed a large number of high-profile websites had BFA left on production.  Wrote a tool that can detect basic BFAs for CMSs configuration files. Previous Researches
  • 21. Don't publicly expose .git or how we downloaded your website's sourcecode – Internetwache - 2015  A research done by Internetwache on GIT VCS, and how it can leak web- applications' source-code and data.  Demonstrated different techniques for real-world exploitation of missed GIT repositories on production.  Tested Alexa top 1M websites for web-applications that left GIT repositories on production.  Published a set of scripts to automatically tries to retrieve files from GIT repositories. Previous Researches
  • 22.  Backup-File Artifacts are caused by different ways, mostly, it’s the admin/developer mistake to allow it accessible.  Exploitation of Human-Based BFA and BFAs that is caused by code-editors can be done as the following: Example:- Saying that index.php.bak is discovered. Wrapping Ideas Together
  • 23.  Having the meta directory of Control Version Systems accessible also leads to source-code and data disclosure. Wrapping Ideas Together
  • 24. Wrapping Ideas Together Source-Code and Data Disclosure Human-Based Backup File Artifacts Backup File Artifacts Caused by Code Editors Version Controlling System Meta Directories Backup File Artifacts
  • 25.  Most Open-Source and Commercial Web Vulnerability Scanners DO NOT PERFORM TESTING FOR BACKUP FILE ARTIFACTS.  Examples of Tested Open-Source Scanners That Do Not Perform BFA Checks:- • OWASP ZAP 2.4 • Vega • W3AF – There are partial plugins that does basic testing, but it’s disabled by default. • Nikto 2.4.6 The Problem
  • 26.  There are very few current Scanners that performs Backup Artifacts. Testing. However, those rare scanners only test the very basic pattern of BFA.  Many Important patterns testing are MISSED! The Problem
  • 27. BFA Findings in Real-World Paypal BFA That Lead to RCE - Ebraheem Hegazy  Ebraheem found a script called upload.php on a Paypal-owned server.  wrote script to test for BFA, and to check if the script exist on other subdomains.  Found a BFA for upload.php, and transformed the Blackbox testing to whitebox testing.  After source-code reviewing it, he found a bug that leads to RCE. Profit: Got an RCE exploit on a Paypal server. Paypal fixed the issue, and he was awarded a nice bounty.
  • 28. BFA Findings in Real-World ISC.org BFA that Disclosed Database Credentials - Feross Aboukhadijeh  During Feross’s research, he tested ISC.org for BFA on Wordpress configuration files, wp-config.php.  He found a BFA left on the main production site of ISC.org, containing database credentials. Profit: The researcher had potentially valid credentials to ISC.org (“potentially” is said, as the researcher stated that he didn’t use it gain unauthorized access). Feross reported it to ISC.org, and they have fixed it.
  • 29. BFA Findings in Real-World A Collection of BFAs - Mazin Ahmed  Used BFAC to discover a number of BFA issues on web-applications, mostly for confidential clients.  BFA Findings Leads To: • Credentials leakage. • Turning testing to whitebox. • Finding additional security vulnerabilities. • RCE. • SQLI. • XSS. • Even more BFA issues. • etc...
  • 30.
  • 31.  About the Project:  BFAC (Backup-File Artifacts Checker) is an automated tool that checks for backup artifacts that may discloses the web-application's source code.  BFAC goal is to be an all-in-one tool for backup-file artifacts black-box testing.
  • 32. Introducing BFAC  About the Project:  Code Specifications:-  Written in pure Python.  Compatible with both Python2.x and Python3.x.  Cross-Platform: Works on Linux, Windows, Mac, Android, and IOS.  Requires a slight amount of resources/modules.  API friendly.  Released under GNU GPLv3.0 License.
  • 33. Introducing BFAC  About the Project:  Features:-  Testing all common types of backup-file artifacts patterns, including human-based BFAs, and BFA that can occur via code-editors.  Includes tests for common VCS artifacts, such as GIT, Subversion, Mercurial, and Bazaar.  Smart detection techniques: Capable of detecting "Not Found", and valid pages using different tests.  Stealthy Interaction with Web Servers.  Easy to edit and customize based on needs; easy to add custom BFA patterns.  Dynamic and generic; made to be not specified to test a specific environment or server.
  • 35. Downloading and Installing BFAC  Cloning BFAC $ git clone https://github.com/mazen160/bfac.git  Installing BFAC ( for *NIX machines) As simple as: $ python install.py confirm
  • 36. Using BFAC  Performs basic tests on the link, showing all attempts, and using random user-agents on each request. $ bfac --url 'http://example.com/test.php' --verbose --random-agent  Ignore 500 and 503 HTTP response codes when is detected as findings. $ bfac --url 'http://example.com/test.php' --verbose --exclude- status-codes 500,503
  • 37. Using BFAC  Default option to confirm the existence of the BFA is set to check both of the HTTP Status Codes and the Content Length (set to “both”).  Rely only on HTTP Status Codes for confirming the existence of the BFA. $ bfac --url 'http://example.com/test.php' --verbose --verify-file- availability status_code  Rely only on Content Length measures in order to confirm the existence of the BFA. $ bfac --url 'http://example.com/test.php' --verbose --verify-file- availability content_length
  • 38. Using BFAC  Perform BFA testing for all current testing levels (Level 4 includes tests from all below levels). $ bfac --url 'http://example.com/test.php' --verbose --level 4  Print a clean output with only findings, separated by newlines. Suitable for APIs and integration with other tools. $ bfac --url 'http://example.com/test.php' --no-text --level 4
  • 39. Mitigation Developer-Level:-  Awareness  Probably the only reliable solution.  Developers' behavior regarding actions on production-level and publicly accessible applications are the main reason for this vulnerability type to occur. Software-Level:-  Access rules seems to be useful in blocking some of the patterns. However, it does not protect as needed.
  • 40. Questions? Mazin Ahmed Twitter: @mazen160 Email: mazin AT mazinahmed DOT net Website: https://mazinahmed.net LinkedIn: https://linkedin.com/in/infosecmazinahmed