Conducting Web Application Pentests. From Scoping to Report For Education Purposes Only



Similar documents
(WAPT) Web Application Penetration Testing

How to break in. Tecniche avanzate di pen testing in ambito Web Application, Internal Network and Social Engineering

Introduction:... 1 Security in SDLC:... 2 Penetration Testing Methodology: Case Study... 3

WEB SECURITY CONCERNS THAT WEB VULNERABILITY SCANNING CAN IDENTIFY

Web Application Penetration Testing

ArcGIS Server Security Threats & Best Practices David Cordes Michael Young

The Top Web Application Attacks: Are you vulnerable?

Adobe Systems Incorporated

Cracking the Perimeter via Web Application Hacking. Zach Grace, CISSP, CEH January 17, Mega Conference

OWASP Top Ten Tools and Tactics

The purpose of this report is to educate our prospective clients about capabilities of Hackers Locked.

HackMiami Web Application Scanner 2013 PwnOff

ASL IT SECURITY BEGINNERS WEB HACKING AND EXPLOITATION

Web application testing

Using Free Tools To Test Web Application Security

Where every interaction matters.

EVALUATING COMMERCIAL WEB APPLICATION SECURITY. By Aaron Parke

Vulnerability Assessment and Penetration Testing

Recon and Mapping Tools and Exploitation Tools in SamuraiWTF Report section Nick Robbins

Essential IT Security Testing

Secure development and the SDLC. Presented By Jerry

Executive Summary On IronWASP


Bust a cap in a web app with OWASP ZAP

External Vulnerability Assessment. -Technical Summary- ABC ORGANIZATION

1. Introduction. 2. Web Application. 3. Components. 4. Common Vulnerabilities. 5. Improving security in Web applications

Web Application Report

Web Application Vulnerability Testing with Nessus

Using Nessus In Web Application Vulnerability Assessments

ASL IT Security Advanced Web Exploitation Kung Fu V2.0

Chapter 1 Web Application (In)security 1

Excellence Doesn t Need a Certificate. Be an. Believe in You AMIGOSEC Consulting Private Limited

ABC LTD EXTERNAL WEBSITE AND INFRASTRUCTURE IT HEALTH CHECK (ITHC) / PENETRATION TEST

Web Application Hacking (Penetration Testing) 5-day Hands-On Course

Magento Security and Vulnerabilities. Roman Stepanov

Ethical Hacking as a Professional Penetration Testing Technique

Web Application Attacks And WAF Evasion

Creating Stronger, Safer, Web Facing Code. JPL IT Security Mary Rivera June 17, 2011

BASELINE SECURITY TEST PLAN FOR EDUCATIONAL WEB AND MOBILE APPLICATIONS

Web Application Security

Criteria for web application security check. Version

Attack and Penetration Testing 101

Web Application Security

Cloud Security:Threats & Mitgations

The Security Development Life Cycle

Cyber Security Challenge Australia 2014

Application Security Testing

Application Security Testing. Erez Metula (CISSP), Founder Application Security Expert

National Information Security Group The Top Web Application Hack Attacks. Danny Allan Director, Security Research

ETHICAL HACKING APPLICATIO WIRELESS110 00NETWORK APPLICATION MOBILE MOBILE0001

Still Aren't Doing. Frank Kim

June 2014 WMLUG Meeting Kali Linux

Thick Client Application Security

Detecting Web Application Vulnerabilities Using Open Source Means. OWASP 3rd Free / Libre / Open Source Software (FLOSS) Conference 27/5/2008

EC-Council CAST CENTER FOR ADVANCED SECURITY TRAINING. CAST 619 Advanced SQLi Attacks and Countermeasures. Make The Difference CAST.

OWASP Application Security Building and Breaking Applications

State of The Art: Automated Black Box Web Application Vulnerability Testing. Jason Bau, Elie Bursztein, Divij Gupta, John Mitchell

Penetration Testing with Kali Linux

Rational AppScan & Ounce Products

Learn Ethical Hacking, Become a Pentester

How to hack a website with Metasploit

Members of the UK cyber security forum. Soteria Health Check. A Cyber Security Health Check for SAP systems

CYBERTRON NETWORK SOLUTIONS

Web Application Security: Exercise Development Approaches

Internal Penetration Test

Detecting and Exploiting XSS with Xenotix XSS Exploit Framework

Web application security

WHITE PAPER. FortiWeb and the OWASP Top 10 Mitigating the most dangerous application security threats

Enterprise Application Security Workshop Series

Real World Web Service Testing For Web Hackers

Web Security Testing Cookbook*

STABLE & SECURE BANK lab writeup. Page 1 of 21

3. Broken Account and Session Management. 4. Cross-Site Scripting (XSS) Flaws. Web browsers execute code sent from websites. Account Management

Pentests more than just using the proper tools

Penetration Testing. Types Black Box. Methods Automated Manual Hybrid. oless productive, more difficult White Box

Data Breaches and Web Servers: The Giant Sucking Sound

elearning for Secure Application Development

Nuclear Regulatory Commission Computer Security Office Computer Security Standard

Is Drupal secure? A high-level perspective on web vulnerabilities, Drupal s solutions, and how to maintain site security

OWASP AND APPLICATION SECURITY

SENSITIVE AUSTRALIAN SPORTS COMMISSION ATHLETE MANAGEMENT SYSTEM (AMS) SMARTBASE SECURITY TEST PLAN. Final. Version 1.0

Practical Identification of SQL Injection Vulnerabilities

Web Application Security. Vulnerabilities, Weakness and Countermeasures. Massimo Cotelli CISSP. Secure

JOOMLA SECURITY. ireland website design. by Oliver Hummel. ADDRESS Unit 12D, Six Cross Roads Business Park, Waterford City

Passing PCI Compliance How to Address the Application Security Mandates

QualysGuard WAS. Getting Started Guide Version 3.3. March 21, 2014

Overview of the Penetration Test Implementation and Service. Peter Kanters

Web applications. Web security: web basics. HTTP requests. URLs. GET request. Myrto Arapinis School of Informatics University of Edinburgh

Introduction to Web Application Security. Microsoft CSO Roundtable Houston, TX. September 13 th, 2006

Testnet Summerschool. Web Application Security Testing. Dave van Stein

Cloud Application Security Assessment, Guerrilla Style

OWASP TOP 10 ILIA

Secure Web Development Teaching Modules 1. Security Testing. 1.1 Security Practices for Software Verification

What is Web Security? Motivation

Web Application Firewalls Evaluation and Analysis. University of Amsterdam System & Network Engineering MSc

Pentests more than just using the proper tools

Transcription:

Conducting Web Application Pentests From Scoping to Report For Education Purposes Only

Web App Pen Tests According to OWASP: A Web Application Penetration Test focuses only on evaluating the security of a web application.the process involves an active analysis of the application for any weaknesses, technical flaws, or vulnerabilities. Any security issues that are found will be presented to the system owner together with an assessment of their impact and often with a proposal for mitigation or a technical solution.

About Me Security guy for over 6 years now. Currently working for a Fortune 500 company doing web application and infrastructure pentesting. Recently new father.

Tip If you have any interest in web app pentesting, get these books!

Topics Why Tools OWASP Top 10 Scoping What to Gather Before Starting Recon / Discovery Application Mapping Attacking Common vulnerabilities Cleanup Reporting

Settings up Browsers and Tools OWASP ZAP and Burp Great tools for the price.. Free and under $300. Lots of add-ons to these. Configure browser for pentesting and web development. Chrome and Firefox/IceWeasle Manta project OWASP Hacking Plugins Developer Tools

Why Web App Pentest Perimeter security getting better. Almost all companies have web presence. More company transactions being done through e-commerce sites. Harder to detect in a lot of cases. NIPS/NIDS don t protect well. Multiple attack points. Can attack your customers, data, and reputation by abusing web apps. Easy for attacker to hide. Compliance requirements.

Selling Web App Pentest Can be huge impact to name brand. Web apps can lead to other system compromises through attack chaining. Internal threat agents can utilize internal web app vulnerabilities to gain greater access. Web App pentest can help identify issues with or lack of SDLC (Software Development Life Cycle) Identify common build configuration issues with web servers. Help to drive secure coding standards within an organization. Provides insight on if 3 rd party software is putting you at risk.

Don t Be Like.

Tools Many to choose from. Match tools to technology. Web App scanners differ. Some are better at detecting other things. http://sectooladdict.blogspot.com/2012/07/201 2-web-application-scanner-benchmark.html Validate findings. High false positive rates. Free vs. Pay

Tools Continued Need a good proxy with the ability to spider. Burp OWASP ZAP Fiddler Good web vulnerability scanners. Burp OWASP ZAP Accuntix W3AF Most infrastructure vulnerability scanners include some web app scanning though not good ones. Good Decoder/Encoder Good Web Browser with Plugins Foxy Proxy Developer Tools Etc

Hands On Kali Linux or BackTrack 5. Test Environment using OWASP BWA and DVWA specifically. Use ZAP and if you have the resources you can run it through BURP. Don t destroy VM s for others. Don t hack others, just hands on virtual machines. Your scope is $ipaddress/dvwa. That directory and all sub directories. Stay in scope!

Test Environment Info Must connect to wireless network Targets: 192.168.1.1-10

OWASP TOP 10

OWASP Top 10 A1 Injection LDAP, OS, SQL A2 Broken Auth and Session Management Auth bypasses Cookies Session Hijacking A3 XSS (Cross-Site Scripting) Reflective Persistent (Stored) DOM A4 Insecure Direct Object Reference - Being able to access objects without proper permission. A5 Security Misconfiguration Tons of possibilities here

OWASP Top 10 Continued A6 - Sensitive Data Exposure CC # s Personal Data Valid User Accounts A7 Missing Function Level Access Control Validate requests being submitted to the server. A8 Cross-Site Request Forgery Hidden iframe Clickjacking A9 Using Components with Known Vulnerabilities Framework version vulnerabilities. A10 Unvalidated Redirects and Forwards Redirecting to other pages or websites. Sending user to malicious website

Setting Up The Pentest

Scoping Pentest type? (Black, Gray, White) Source code review? Reason for the pentest? Code update. Compliance requirement. Identify attack scope. (How far down the rabbit hole can you go.) Demonstrate vs Fully Exploit Try and set up scope to match that of a real threat. Usually won t get permission. Attack chaining. What hours can the pentest be conducted during? Have had groups try and only allow 2 hours per day on huge application. Is there a code freeze? Is there scheduled patches, or updates during the pentest? Is there schedule downtime? Production or UAT/DEV/TEST> Make sure it s a true representation of production.

Scoping Continued Identify size of the application. How many: lines of code input points different parameters Types of technology used. (If not black box testing) Server Type (IIS, Apache, Websphere, ect.) Multiple Databases? 3 rd party content? Flash objects? Framework. WSDL s? Web Services? API? Types of functionality within the application. Does the website send or receive files? WebDAV. Is there any mobile components? JAVA RMI How many user roles? Admin role, External User, Internal User?

Questions to Ask Who is the primary contact for the penetration test? Someone should be available during operating hours of the pentest. This person should be able to expand scope if needed. (new functionality identified, trust relationships in place open scope to other systems) Who can engage developers or security people for discussions if needed. Possible to get network diagram? (identify load balancers, proxies, WAFS, etc)

Engagement Description Covers what was agreed upon. Primary contacts (tester and business contact) Who gets the report. How often is there status updates? State what was agreed upon for timeline. Hours for testing. Length of testing. Time provided for report writing. Finally Delivery Day Retesting / Remediation Validation Exit Meeting Scope. Make sure to cover what is not allowed too. Covers potential impacts and what to do if there is one. If doing contracting pentest or as a 3 rd party make sure all work documents are completed as well. (SOW, NDA, ect.) CYA!

Grey and White Box Testing Make sure to gather the right info. Previous Findings / Pentest Results Sometimes retests show lack of remediation. Point that out in the final report. Source code if possible. Two user accounts per user roles. Supporting documentation. Database Version and Types. Framework versions. Webserver version.

Starting the Pentest

Recon / Discovery Identify Web Server, and Technologies in Use. HTTP Header Leakage Openssl s_client Proxy Nmap Scripts Nmap sv Whatweb good at gathering information. Load balancing detection.- Halberd (also included in W3AF.) WAF Detection Waffit, http-waf-fingerprint.nse Known vulnerabilities?

Recon / Discovery Continued Directory Bruteforce WSDL? SOAP? Web Services? WebDav? Flash? AJAX?

Recon/Discovery Black Box Shodan - http://www.shodanhq.com/ Google Hacking Bing Tor Wayback Machine Reconng Maltego Zmap University of Michigan Project Sonar Rapid 7 https://community.rapid7.com/community/infosec/sonar/blog * Things that do not directly connect to the client from your box.

Application Mapping Browse site through proxy. Build tree for spidering. Identify a user work flow. How does the application work? Function dependencies. Gain a good understanding of the application. Look at the code if provided, look at source otherwise. Are there patterns? Comments in the code? Parameters named specific way? Engagement tools from Burp will pull this out.

DEMO DVWA Recon/Mapping using Whatweb, Burp and ZAP.

Authentication A2 Identify how the website validates you. Identify if there is hidden fields that are static or unique. Is there data send in POST or GET request that is static or unique? Can you bypass authentication and directly browse to page? Are there admin portals? Default creds? Are secure passwords required? * secure might depend on company policy. Can the password reset portal be abused. Use the two accounts if there is static values, see if you can do a horizontal priv. escalation.

COOKIES

Authentication - Cookies Are cookies easily decoded? Base encoded, IP address, Time/Date etc. Is the HTTPOnly and Secure flags set? How much entropy is in the cookie value? Does the cookie change on state change? First visit to page, Successful Sign In, Signoff.

A1 - Injection

SQLi A1 - Injection Usually start with providing to user input and check for errors or unexpected returned data. Identify where user input might be included in a query. Scanners can be decent at detection. Can lead to complete system compromise, not just data. SQLi Blind Return might not be to UI. Time Based Content Based OS Command Injection Does it seem to use OS commands to run queries, or provide function? Try submitting, and &, ;, and look for results.

A1 Injection Continued LDAP Injection Inject &, *, (, ), [, ],!,

DEMO SQL Injection with Zap fuzzer. SQLMap

A3 - XSS / Cross-Site Scripting Injecting code. Can own a website with it, contrary to what developers will argue. Attack Chaining. Cookie Stealing Reflective vs Stored BeEF Framework + Metasploit = Fun

Beef and Metasploit In beef/config.yaml enable meteasploit support. Kali dir /usr/share/beef-xss. Set MSGRPC password in beef/extensions/metasploit/config.yaml Start metasploit Run: load msgrpc ServerHost=127.0.0.1 Pass=abc123 *example only but default Beef config setting.

Beef and Metasploit

Beef Exploitation

BeEF Multiple Exploitation Paths Java Applet/ Key logger Malicious Redirects A10 Cookie Stealing. Browser Exploitation through Metasploit Powershell download and execute.

Cleanup Delete any persistent XSS you ve created. Can always reproduce if necessary. Already have screen shots right? Delete any additional things you ve created unless they want evidence. Notify customer that they can remove test accounts unless they want to keep them available for remediation testing.

The Report Most important piece of the pentest. This is what adds value and will help towards remediation and risk reduction. Customize to technologies and client. Include detailed remediation options and links. Include screenshots and url s for findings. Error on the side of more detail. Customers might not always read and comprehend the report. Expect to have to explain.

Finding Example Finding: SQL Injection Risk Rating: Critical Business Impact: SQL Injection attacks can affect all security aspects of a web application. Data integrity, availability, and confidentiality can all be impacted. It was possible to extract all the information from the database and to extract password hashes of valid users. With the access level obtained during the penetration test, it would also be possible to change and modified stored data. Steps to Reproduce: 1. Login to the application at: http://ipaddress/dvwa utilizing the provided accounts. 2. Click on the SQL Injection page at http://ipaddress/dvwa/vulnerabilities/sqli/ 3. Input and notice SQL syntax error due to user input.

Finding Example Continued Expected Outcome: User input is properly escaped, and validated. Parameterized queries are used to validate user input into SQL queries. Actual Outcome: User input is not properly escaped or validated by the application. By injecting into the input field it was possible to detect a SQL injection. It was possible to use the SQL injection to enumerate all data within the database, including usernames and password hashes.

Finding Example Continued Remediation: Implement PHP Data Objects and use prepared statements, also known as parameterized queries for database queries. This prevents malicious user input from being used directly in the query itself. In addition, make sure to implement system hardening and security recommended settings for MySQL. Example of PHP parameterized query: <?php $stmt = $dbh->prepare("select * FROM REGISTRY where name =?"); if ($stmt->execute(array($_get['name']))) { while ($row = $stmt->fetch()) { print_r($row); } }?> http://us2.php.net/pdo.prepared-statements https://www.owasp.org/index.php/owasp_backend_security_project_mysql_hardening

Final Exit Meeting Hand over report if not already handed over. Discuss findings. Answer questions. Reiterate how remediation validation is going to take place.

QUESTIONS?

Resources and Links Burp Pro $300 portswigger.net/burp OWASP - https://www.owasp.org/index.php/main_page Top 10 - https://www.owasp.org/index.php/top_10_2013 ZAP - https://www.owasp.org/index.php/owasp_zed_attack_proxy_project Acunetix - http://www.acunetix.com/ Fiddler - http://fiddler2.com/ Web App Security Blogs http://www.troyhunt.com/ Pentesting Standard http://www.pentest-standard.org Test Environments Security Dojo - http://sourceforge.net/projects/websecuritydojo/ Broken Web Apps - https://code.google.com/p/owaspbwa/

Resources and Links SQLMAP http://www.slideshare.net/hcoduarte/sqlinjection-with-sqlmap http://sqlmap.org/ https://www.owasp.org/index.php/automated_ Audit_using_SQLMap OWASP Top 10 Ebook http://www.troyhunt.com/2011/12/free-ebookowasp-top-10-for-net.html