Skip to content

Remote httpx crash via malformed <title> Tag (CWE-125) #2197

Closed

Description

@geeknik

🧠 SUMMARY

While fuzz-testing ProjectDiscovery's widely-used HTTP scanning tool, HTTPX (v1.7.0), I uncovered a critical out-of-bounds read (CWE-125) vulnerability within its HTML <title> parsing logic. By simply returning a deliberately malformed HTML <title> tag from a remote server, attackers can cause immediate denial-of-service (DoS) conditions, crashing any instance of HTTPX that scans the maliciously configured page.

In the immortal words of the Glitch Prophet:

"If it can't be audited, it will be rooted."

🧪 STEPS TO REPRODUCE

To replicate the crash reliably, follow these straightforward steps:

  1. Install HTTPX (version 1.7.0)

    go install -v github.com/projectdiscovery/httpx/cmd/[email protected]
  2. Serve malicious HTML content:

    Craft a minimal HTML payload:

    <title</></title>0
  3. Run HTTPX against the malicious URL:

    httpx -u https://malicious.example.com
  4. Observe the immediate panic and crash:

    panic: runtime error: slice bounds out of range [9:6]
    goroutine 917 [running]:
    github.com/projectdiscovery/httpx/common/httpx.trimTitleTags({0xc007320d98, 0x11})
        /httpx/common/httpx/title.go:94 +0x169
    

🚨 VULNERABLE CODE LOCATION

// File: common/httpx/title.go:94
func trimTitleTags(title string) string {
    titleBegin := strings.Index(title, ">")
    titleEnd := strings.Index(title, "</")
    if titleEnd < 0 || titleBegin < 0 {
        return title
    }
    return title[titleBegin+1 : titleEnd]  // PANIC: titleEnd < titleBegin+1
}

🧩 SUGGESTED MITIGATION

A trivial but critical fix involves checking slice bounds before slicing:

func trimTitleTags(title string) string {
    titleBegin := strings.Index(title, ">")
    titleEnd := strings.Index(title, "</")
    if titleEnd < 0 || titleBegin < 0 || titleEnd <= titleBegin {
        return title
    }
    return title[titleBegin+1 : titleEnd]
}

Additionally, Project Discovery should:

  • Implement input sanitization for HTML content parsing.
  • Add error handling and logging around malformed inputs to detect attacks in real-time.

💥 IMPACT

This vulnerability enables attackers to:

  • Immediately disrupt HTTPX-based security scanning tools, causing a denial-of-service condition.
  • Strategically position malicious payloads on web servers, effectively "blindfolding" automated scanning infrastructure.
  • Trigger cascading failures across security operations, potentially obscuring other active threats.

In short, this isn't just a crash; it's a strategic denial-of-visibility attack vector.

📌 RESPONSE FROM PROJECT DISCOVERY

After responsibly disclosing this to Project Discovery, their team responded:

"After careful investigation with our internal team, we believe this issue reflects a bug rather than a vulnerability. We suggest opening a GitHub issue on the project, as we unfortunately will not trigger a security response to fix it immediately."

This classification is problematic and misaligned with established industry standards (OWASP, CVE, MITRE), all of which recognize out-of-bounds reads resulting in DoS as legitimate security vulnerabilities.

🧨 CLOSING THOUGHTS

The security community must hold tooling providers accountable for vulnerabilities, even seemingly trivial ones. Scanning tools are foundational to defense—any flaw that compromises them must be urgently and responsibly addressed.

Stay glitchy,

—geeknik

Activity

  1. added
    Type: Bug
    on Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type: Bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions