CVE-2016-5394: Cross-Site Scripting in Apache Sling

Summary

13/05/2022
Yes i
Moderate
6.1

CVE-2016-5394: Cross site scripting in Apache Sling. Affects org.apache.sling:org.apache.sling.xss versions < 1.0.12. Fixed in 1.0.12. 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 Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Apache Sling is a web framework that allows developers to create content-oriented applications. It provides a set of tools and libraries for building RESTful web applications using Java. The Apache Sling XSS Protection API module is responsible for protecting against cross-site scripting (XSS) attacks by encoding user input. However, a vulnerability in the encoding process allows certain input patterns to bypass the encoding and potentially lead to XSS vulnerabilities.

Vulnerability Detail

The XSS Protection API module in Apache Sling, specifically the XSSAPI.encodeForJSString() method, does not apply strict enough encoding for certain input patterns. This allows script tags to pass through unencoded, making it possible for an attacker to inject malicious scripts into web pages. This can lead to various consequences, such as session hijacking, defacement of web pages, or stealing sensitive user information.

How To Fix

Minimum fixed version

1.0.12

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading the package is not immediately feasible, a temporary workaround is to manually sanitize user input before using it in web pages. This can be done by applying appropriate encoding or escaping techniques to ensure that any potentially malicious scripts are neutralized. Here is an example of how to sanitize user input in Java:

String sanitizedInput = StringEscapeUtils.escapeHtml4(userInput);

Conclusion

In conclusion, the Apache Sling XSS Protection API module is vulnerable to a cross-site scripting (XSS) attack due to insufficient encoding. Upgrading to version 1.0.12 or later of the org.apache.sling.xss package is recommended to mitigate this vulnerability. If immediate upgrade is not possible, manual sanitization of user input can serve as a temporary workaround. For further assistance and support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for org.apache.sling:org.apache.sling.xss →

Share this vulnerability

FAQ

Apache Sling is a web framework that allows developers to create content-oriented applications. It provides a set of tools and libraries for building RESTful web applications using Java.

Cross-site scripting (XSS) is a type of security vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users. This can lead to various consequences, such as session hijacking, defacement of web pages, or stealing sensitive user information.

The XSS Protection API module in Apache Sling provides a set of methods for encoding user input to prevent XSS attacks. The encodeForJSString() method is specifically designed to encode input for use in JavaScript strings.

This vulnerability allows an attacker to inject malicious scripts into web pages, potentially leading to session hijacking, defacement of web pages, or stealing sensitive user information.

To fix this vulnerability, upgrade the org.apache.sling.xss package to version 1.0.12 or later. This version includes stricter encoding rules that prevent script tags from bypassing the encoding process.

Related vulnerabilities

Recent vulnerabilities recorded for org.apache.sling:org.apache.sling.xss.

How To Fix

Minimum fixed version

1.0.12

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. 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