CVE-2022-39348: Twisted vulnerable to NameVirtualHost Host header injection

Published Oct 26, 2022
·
Updated

Twisted is an event-based framework for internet applications. Started with version 0.9.4, when the host header does not match a configured host twisted.web.vhost.NameVirtualHost will return a NoResource resource which renders the Host header unescaped into the 404 response allowing HTML and script injection. In practice this should be very difficult to exploit as being able to modify the Host header of a normal HTTP request implies that one is already in a privileged position. This issue was fixed in version 22.10.0rc1. There are no known workarounds.

Other sources

When the host header does not match a configured host, twisted.web.vhost.NameVirtualHost will return a NoResource resource which renders the Host header unescaped into the 404 response allowing HTML and script injection.

Example configuration: python from twisted.web.server import Site from twisted.web.vhost import NameVirtualHost from twisted.internet import reactor

resource = NameVirtualHost() site = Site(resource) reactor.listenTCP(8080, site) reactor.run() Output: ❯ curl -H"Host:<h1>HELLO THERE</h1>" http://localhost:8080/

<html> <head><title>404 - No Such Resource</title></head> <body> <h1>No Such Resource</h1> <p>host b'<h1>hello there</h1>' not in vhost map</p> </body> </html>

This vulnerability was introduced in f49041bb67792506d85aeda9cf6157e92f8048f4 and first appeared in the 0.9.4 release.

GitHub

Affected Software

8 affected componentsFixes available
ubuntu/twisted<18.9.0-11ubuntu0.20.04.3
18.9.0-11ubuntu0.20.04.3
ubuntu/twisted<22.1.0-2ubuntu2.4
22.1.0-2ubuntu2.4
ubuntu/twisted<22.4.0-4
22.4.0-4
debian/twisted<=18.9.0-3+deb10u1, <=20.3.0-7+deb11u1
18.9.0-3+deb10u222.4.0-423.10.0-2
pip/twisted>=0.9.4<22.10.0rc1
22.10.0rc1
Twisted Twisted>=0.9.4<22.10.0
Debian Debian Linux=10.0
twistedmatrix Twisted>=0.9.4<22.10.0

Event History

Oct 26, 2022
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·08:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Advisory Published
via GitHub·10:08 PM
Jan 12, 2024
Data Sourced
via Launchpad·12:11 AM
Description

Parent advisories

This vulnerability appears in the following advisories.

Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the vulnerability ID of this security issue?

The vulnerability ID is CVE-2022-39348.

2

What is the severity of CVE-2022-39348?

The severity of CVE-2022-39348 is medium with a CVSS score of 5.4.

3

Which software versions are affected by CVE-2022-39348?

Versions of Twisted from 0.9.4 to 22.10.0 and Debian Linux 10.0 are affected by CVE-2022-39348.

4

How does CVE-2022-39348 impact the application?

CVE-2022-39348 allows the host header to be rendered unescaped into the 404 response, potentially exposing HTML and script injection vulnerabilities.

5

How can I fix the vulnerability CVE-2022-39348?

To fix CVE-2022-39348, make sure to update Twisted to version 22.10.0 or later, or apply the necessary security patches provided by the vendor.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203