Web Application Attacks Flashcards
What is the first thing you should do before launching an attack on a web server?
Discover the technology stack in use:
- Programming language and frameworks
- Web server software
- Database software
- Server operating system
What are common web site enumeration steps?
- Inspect URLs: file extensions reveal programming language, such as .php, .jsp, .do, .html
- Inspect Page Content: debugger tools may display JavaScript frameworks, hidden input fields, comments, client-side controls within HTML, JavaScript
- View Response Headers: in Firefox the Network tab of the Web Developer menu
- Inspecting Site Maps: robots.txt, sitemap.xml; use curl to get
- Locate Administrator Consoles
How would you use ‘curl’ to get robots.txt for google.com?
curl https://www.google.com/robots.txt
What is the open source web server scanner?
Nikto
How would you run Nikto against megacorpone.com for 30 seconds?
nikto -host=http://www.megacorpone.com -maxtime=30s
How can you use Intruder to brute force a phpMyAdmin login page if there is a unique ‘set_session’ value and a ‘token’ value required for each login?
- In Positions Tab: select phypMyAdmin, set_session, password, and token values
- Select “Pitchfork” as the attack type
- Options Tab > Grep Extract > Add: define ‘grep’ extraction to begin after _session” value=” and end at “ />Log (this will grab the ‘set_session’ string)
- Add another Grep Extract: start grep extraction after en” value=” and end at “ />\n\n (this will grab the token value)
- Payloads Tab: for Payload set 1 is for the phpMyAdmin session cookie; set Payload Type to “Recursive Grep” and select the first Recursive Grep option set above
- Payloads Tab: Payload set 2 is for “set_session”; it needs to match the value of the “phpMyAdmin cookie”, so it is the same value as option 1
- Payloads Tab: Payload set 3 is for “password” and use a simple list of passwords
- Payloads Tab: Payload set 4 is for the token value; use the 2nd “Recursive Grep” option
What would be your next action to take after successfully logging into phpMyAdmin console?
Run database SQL queries against user table to find credentials
What allows XSS to take place?
Web application allowing unsanitized data, thereby allowing attackers to inject and potentially execute malicious code.
Stored XSS
- aka Persistent XSS
- occurs when the exploit payload stored in a database or otherwise cached by a server
- the web application then retrieves this payload and displays it to anyone that views a vulnerable page
- a single stored XSS can therefore attack anyone that visits the page
Reflected XSS
- usually include the payload in a crafted request or link
- the web application takes this value and places it into the page content
- this variant only attacks the person submitting the request or viewing the link
- often occur in search fields and results, as well as anywhere user input is included in error messages
URL Encoding
- sometimes referred to as percent encoding
- used to convert non-ASCII characters in URLs
- Example: converting ‘space’ to %20
HTML Encoding
- used to display characters that normally have special meaning, like tag elements
- Example: <, is the character reference for “
What is a simple way to see if a web page is sanitizing data, or not?
- if there is a comment posting page, like for a blog post, you can enter ‘hello “ ; < > ‘ and see if the characters are posted as they are
- If the characters are posted as is, and not HTML encoded, the site does not sanitize user input
What is a stealthy alternative to a XSS redirect?
- inject an invisible iframe into our XSS payload
- this will embed the file “report” into the HTML file
- once this payload has been submitted, any user that visits the page will connect back to our attack machine
What are the two Cookie flags that are of most interest to an attacker?
- Secure
- HttpOnly