Show Menu
Cheatography

Web Application PenTesting Cheat Sheet (DRAFT) by

Journey of finding bugs

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Notes

References
Bug bounty cheatsheet
Hacktricks cheatsheet
Tools introd­uction
Learn
Understand concept from youtube
Read reports on the web, medium, hackerone, twitter, reddit etc..
Practice
Docker websploit
PortSw­igger Academy
 
Resources

Checklist

Understand the flow of applic­ation
Exploit it | 1Recon - 2 Checklist
 
Password reset
Change host header
No rate limit

Bug Hunting Methodlogy

Jason Haddix
Approa­ching target
Oneforall
Amass
Nuclei
Lazyrecon
Burpsuite
Ffuf
WaybackURL
Burp
Goto Scope and click use advanced scope control
Now we can enter a "­ter­m" instead of a domain name
Click on add and inside host field enter only the target name like office
Pop-up will come up Click no as we still want stuff outside of this term
Go back to Sitemap and open menu
Click on first option: Show only in scope items
Now you can see only those URL with only that term
Select all relevant domains or open more and Click on Scan, So that we can crawl all these URLs
Menu: Scan details: Select crawl option and you can see a list of URLs/D­omains to scan
Scan config­ura­tion: Click on select from Library and select Fastest
Again select from library and select never stop crawl due to applic­ation errors
Apply those 2 and proceed ahead
Goto Resource pool: Click on create new resource pool, assign it a name
click on Maximum concurrent requests: 50
Done Burp has started scanning the target to find more subdomains and maybe root domains. Use the dashboard to track the progress
Tools for Automation
XSS
XSS Hunter
SSRF
Ssrf-Tool Hacktricks
SQL
SQLMAP

SQL Injection

Second order SQL Injection
Using this vulner­ability we can change the password of the particular username
For example ' -- and create a new account blacklist' --
' is Single quote. Used to delineate a query with an unmatched quote
What happens is there is a query like
UPDATE users set passwo­rd=­"new pass" where userna­me=­"­bla­cklist ' --" and passwo­rd=­"this is for current passwo­rd"
Now when i sue this query after -- becomes just a comment which have no use now and it will directly changed the pass of old user

Tips & Tricks

Twitter
With great flexib­ility comes great power of messing things up
Having flexib­ility in web app develo­pment also means having facility in creating creating insecure code

SSRF

SSRF
1) What it is (concept)
In a Server­-Side Request Forgery (SSRF) attack, the attacker can abuse functi­onality on the server to read or update internal resources.
The attacker can supply or a modify a URL which the code running on the server will read or submit data to, and by carefully selecting the URLs, the attacker may be able to read server config­uration such as AWS metadata, connect to internal services like http enabled databases or perform post requests towards internal services which are not intended to be exposed.
2) Where it can be (where to look for)
SSRF exists when the server, as part of one of its features, fetches data or queries an internal or external resource. The key is that this request includes a value that the attacker can manipu­late, potent­ially allowing the attacker to completely change the request being performed by the server.
3) Goal
The user will need to modify the URL.
4) Automation Tool
Hunt RMX (burp extension)
Ssrfmap
SSRF Detecctor
Tips
The more endpoints you find the more scope you have
Tips
If you find a subdomain running and identify the service running i.e.-JIRA then you already know endpoints and can try them
 

Cyber Kill Chain APT-28

Cyber Kill Chain
Phases of Pentes­ting, Recon and Inform­ation gathering is very important phase, A good penetr­ation tester spends 90% of his time in widening the attack surface because he knows this is what its all about. Rest is just a matter of using the correct tools and techniques
1. Reconn­ais­sance | Inform­ation Gathering
2. Footpr­inting | Scanning
3. Vulner­ability Assessment | Vulner­ability identi­fic­ation and analysis
4. Gaining Access | Exploi­tation
5. Mainta­ining Access | Post exploi­tation
6. Clearing Track
7 Reporting | Re-Testing
Penetr­ation Testing - Its a process where each next step is dependent on the previous step, Goal is to test each and every vulner­ability without overlo­ading the client infras­tru­cture
Profes­sional Penetr­ation Testing Process
E I F V E R
Engagement | RoE
Details about penetr­ation test are establ­ished
Quotation: It is in terms of price and estimate of the time required to perform your Job. It depends upon the test is for a network or web applic­ation or whole organi­zation, and also depends upon type of engagement- black, white, gray and complexity
Proposal Submittal: Write proposal keeping in mind clients needs and infras­tru­cture. It should include unders­tanding of client requir­ement and Approach & Method­ology that will be used like automated scans or manual testing, or onsite testing. Also it should include the Risks & Benefit , value that pentest will bring to the organi­zation. Finally Proposal should include the Scope of Engagement
Staying in Scope: Always verify if it is client property and you have written permission to conduct assessment on it. So that you dont break the law as few country have rules and regula­tions that you need to comply with.
Incident Handling: It is an procedure or set of instru­ction that needs to be executed by both the parties involved on how to proceed when an incident occurs. Or have a Emergency contact number that might help in incident handling for the client infras­tru­cture.
Once an emergency contact is set, it should be worth adding a statement to the Rules Of Engagement
Legal Work: Organi­zations wants you to sign NDA (Non-D­isc­los­ure­-Ag­ree­ment). Moreover, as Security Laws vary from country to country you might need to hire a Lawyer. Thus confid­ent­iality must remain, and data cannot be sold to third party, must be encrypted and kept private.
Finally, RoE is document that will define the scope of engagement and put on paper what Pentester is authorized to do and when, this includes the time window for your tests and your contacts in the client organi­zation. And if something goes wrong there should a client contact whom you could coordinate activities or commun­icate in case something goes wrong
Inform­ation Gathering | Reconn­ais­sance
Most crucial stage for success. During this stage, pentester is an invest­igator who wants to harvest inform­ation about the client organi­zation. Also dont engage before the dates as client should not miss a real attack vector. The RoE states if social engine­ering is allowed.
Unders­tanding the Business is an important part as it helps you to understand what is important for your client.
Footpr­inting & Scanning
Vulner­ability Assessment
Vulner­ability identi­fic­ation and analysis
Manual or Automated
Exploi­tation (Gaining Access) | Post exploi­tation (Maint­aining Access) | Clearing Tracks
Gaining Access & Mainta­ining Access & Clearing Track
Reporting
Consul­tancy: This might be required by the Organi­zation after delivering the report as they might need further clarif­ication or help regarding Pentesters Findings. After consul­tancy a pentester should keep report encrypted or better yet, destroy it.
Finally, Inform­ation Gathering & Finger­pri­nting is very important to ensure you make your Target Wider
Widening the Attack Surface. Sticking to the process is the real secret for an effective pentest. For eg - Highly motivated & Experi­enced Hacker spend most of their time invest­igating their victims and gathering inform­ation about them using as many sources as possible, this helps them launch highly targeted attacks that do not trigger alarms in the victim defense system.
A successful and stealthy attack is made possible by a deep unders­tanding of the target which comes from a thorough inform­ation gathering phase

Web Fundam­entals

Pentesting Career
Ability to exploit web applic­ation and finding vulner­abi­lities in web servers and services
Protocol
HTTP used to transfer web pages and data from server to client and vice-versa
HTTP (request & response)
The client usually a web browser connects to a web server, i.e.- Apache HTTP Server and MS ISS
HTTP working
Works on Top of TCP Protocol
First a TCP connection is establ­ished. Then client sends its requests and waits for response. The server processes the request and sends back the response along with a Status Code and Data
Client
SYN
ACK GET /html
Close Connection
Server
SYN ACK
HTML response
Format of HTTP Headers
Headers \r \n
\r \n
To end lines in HTTP, use \r (Carriage Return) & \n (New Line) characters
Message Body
Header­_name : Header­_value
HTTP Request Example
Request Method / PATH, the PATH tells the server which resource browser is asking for and there is Protocol version that tells the server how to commun­icate with the with the browser
Method header
GET - Used to retrieve, 200 code, returns XML or JSON
POST - Used to send content body, i.e- Parameters and Data
PUT - Update Capabi­lites
DELETE - Delete a resource identified by a URI
Host header
HOST header field specifies the internet hostname and port number of the resource being requested
A web server can host multiple websites. This header field tells the server which site the client is asking for
The HOST value is obtained from the URI of the resource
User-Agent header
Tells the server which client software is issuing the requests, a client could be Firefox, Google, Edge and a mobile app
Also reveals the server the operating system version
Accept header
The browser sends the Accept Header field to specify which document type it is expecting in the Response
text/html
Accept­-La­nguage header
Similarly, The browser can ask for a specific language in the response
Accept­-En­coding header
The browser accepts two types of compre­ssion, gzip & deflate
Connection header
The connection header field allows the sender to specify that are desired for that particular connection
i.e.- Connection : keep-a­live, Future commun­ica­tions with the server will reuse the current connection
HTTP Response
When the server receives a request, it processes it and sends back an HTTP response to the client. The response has its own header format. Along with Page Content
Status line
Status code along with Protocol version
Date
Date represents the date and time at which the message was originated
Cache-­Control header
The server informs the client about cached content. Using cache content saves bandwidth as it prevents the client from re-req­uesting unmodified content.
Conten­t-Type
Lets the client know how to interpret the body of the message. i.e. - text/html , charse­t=UTF-8
Conten­t-E­ncoding
It extends Conten­t-Type and If gzip then message body is compressed with the gzip
Server header
The server header field contains the header of the server that generated the content
Very useful field during a Pentest to identify the software running on the Web server
Conten­t-L­ength