CVE-2020-13697: XXS in NanoHTTPD

Summary

25/02/2021
No i
Moderate
Not published

CVE-2020-13697: NanoHTTPD Cross-site Scripting vulnerability. Affects org.nanohttpd:nanohttpd-nanolets versions < 2.3.1. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

NanoHTTPD is a lightweight HTTP server library for Java applications. It provides a simple way to embed a web server into an application. The vulnerability affects versions up to 2.3.1 of the NanoHTTPD library. This library includes the GeneralHandler class, which implements a basic GET handler that prints debug information as an HTML page. If a web server extends this class without implementing its own GET handler, it becomes vulnerable to reflected cross-site scripting (XXS) attacks. This occurs because the GeneralHandler GET handler prints user input passed through the query string without any sanitization.

Vulnerability Detail

The vulnerability in NanoHTTPD allows an attacker to inject malicious scripts into the HTML page generated by the GeneralHandler GET handler. This can lead to the execution of arbitrary code in the context of the victim's browser, potentially compromising sensitive information or performing unauthorized actions. The vulnerability has a moderate severity rating and is classified under CWE-79 (Cross-Site Scripting).

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

If upgrading to a fixed version of NanoHTTPD is not immediately possible, a temporary workaround is to implement a custom GET handler that properly sanitizes user input before including it in the HTML response. This can be done by using a library or framework that provides built-in protection against XXS attacks, such as OWASP Java Encoder. By encoding user input before displaying it in the HTML response, the risk of XXS vulnerabilities can be mitigated.

Conclusion

The XXS vulnerability in NanoHTTPD can be mitigated by upgrading to a fixed version of the library or by implementing proper input sanitization in custom GET handlers. It is important for developers to stay up-to-date with security patches and follow best practices to protect their applications from potential vulnerabilities. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for org.nanohttpd:nanohttpd-nanolets →

Share this vulnerability

FAQ

NanoHTTPD is a lightweight HTTP server library for Java applications. It allows developers to embed a web server into their applications.

Reflected cross-site scripting (XXS) is a type of vulnerability that allows an attacker to inject malicious scripts into a website or web application. These scripts are then executed in the context of the victim's browser, potentially leading to the compromise of sensitive information or unauthorized actions.

The vulnerability in NanoHTTPD allows an attacker to inject malicious scripts into the HTML page generated by the GeneralHandler GET handler. This can lead to the execution of arbitrary code in the context of the victim's browser, potentially compromising sensitive information or performing unauthorized actions.

The vulnerability has a moderate severity rating.

To fix the vulnerability, it is recommended to upgrade to a version of NanoHTTPD that is not affected by the issue. Developers should update their project's dependencies to use a version of NanoHTTPD that is equal to or greater than 2.3.2.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback