Detailed Technical Analysis of "Take Advantage of 'Out of Scope' Domains in Bug Bounty"

Overview:
The write-up by Hussam Al-Hudaib discusses a creative exploitation technique in bug bounty hunting by leveraging "out of scope" domains. These domains, often related to the primary target but not explicitly included in the bug bounty program's scope, can be used to escalate privilege and conduct impactful attacks on "in scope" assets.

Key Technical Details:

  1. Understanding Scope and Out of Scope Domains:
  2. Scope Definitions: Bug bounty programs typically list domains that are eligible for bounty rewards. Out of scope domains are those not considered for valid submissions, often due to their perceived lower risk or because they are third-party services.
  3. Role of Forgotten Domains: These out of scope domains, though often neglected by the application security teams, can still impact the primary domains through indirect attack vectors like shared infrastructure, CNAME records, and OAuth integrations.

  4. Leveraging Subdomain Takeover:

  5. Concept: Subdomain takeover occurs when DNS entries for subdomains point to external services that have been removed or not claimed. Attackers can register these services to take control of the subdomain.
  6. Exploitation: Attackers identify CNAME records pointing to non-existent or unclaimed services (like Azure, AWS, or GitHub Pages) and claim these services to control the subdomain. This can allow complete control over the content served from that subdomain.

  7. Case Study:

  8. Target Identification: The write-up demonstrates identifying valid subdomains linked to out of scope domains through reconnaissance using tools like amass, subfinder, and crt.sh.
  9. Vulnerability Discovery: The author found subdomains pointing to unregistered Heroku services. These subdomains, although not directly in scope, could affect the primary in-scope domains through trust relationships or cross-origin resource sharing (CORS).
  10. Payload Deployment: By registering the service (in this case, Heroku), the author was able to control the subdomain and host a malicious payload. This payload could potentially execute cross-site scripting (XSS), phishing, or other malicious activities on the users visiting it.

  11. Impact on Security:

  12. Trust Relationships: Many primary domains trust subdomains, even if they are out of scope. This trust can lead to severe security implications if these subdomains are compromised.
  13. CORS Exploitation: If a primary domain has improper CORS policies, compromised subdomains may gain unauthorized access to sensitive data by exploiting cross-origin communications.

  14. Defensive Measures:

  15. Proper Scoping: Comprehensive scoping during bug bounty programs should involve critical related assets, including potential risky out of scope domains.

  16. DNS Hygiene: Regular monitoring and auditing of DNS records, ensuring that subdomains do not point to deprecated or unclaimed services.

  17. CORS Policies: Implementing strict and well-reviewed CORS policies to prevent unauthorized cross-origin requests.

  18. HTTP Headers: Using security headers such as Content Security Policy (CSP), X-Frame-Options, and Strict-Transport-Security (HSTS) to reduce the attack surface.

  19. Continuous Monitoring: Setting up continuous integration/continuous deployment (CI/CD) pipelines to frequently audit and monitor DNS changes and service integrations.

Key Takeaways:

Conclusion:

This blog post sheds light on the importance of not underestimating the security risk of out of scope domains in bug bounty programs. It highlights the potential indirect impact these domains can have on the primary target, emphasizing thorough reconnaissance and proactive defense. For detailed steps and a deeper understanding, refer to the original blog post here.