CWEweakness
CWE-116 Improper Encoding or Escaping of Output
High
Official page ↗
- Alternate terms
- Output Sanitization, Output Validation, Output Encoding
- Abstraction
- Class
- Structure
- Simple
- Status
- Draft
- Likelihood of exploit
- High
- Languages
- Go, Not Language-Specific
- CWE version
- 5.0
Description
The product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. As a result, the intended structure of the message is not preserved.
Common consequences
• Integrity, Confidentiality, Availability, Access Control: Modify Application Data, Execute Unauthorized Code or Commands, Bypass Protection Mechanism — The communications between components can be modified in unexpected ways. If an application uses attacker-supplied inputs to construct a structured message without properly encoding or escaping, then the attacker could insert special characters that will cause the data to be misinterpreted as control information or metadata. As a result, the component that receives the output will perform the wrong operations, or otherwise interpret the data incorrectly. Attackers could change the commands that are sent to another component, inserting malicious commands instead, bypassing other security mechanisms.
Potential mitigations
• [Architecture and Design] Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.
For example, consider using the ESAPI Encoding control [REF-45] or a similar tool, library, or framework. These will help the programmer encode outputs in a manner less prone to error.
Alternately, use built-in functions, but consider using wrappers in case those functions are discovered to have a vulnerability.
• [Architecture and Design] If available, use structured mechanisms that automatically enforce the separation between data and code. These mechanisms may be able to provide the relevant quoting, encoding, and validation automatically, instead of relying on the developer to provide this capability at every point where output is generated.
For example, stored procedures can enforce database query structure and reduce the likelihood of SQL injection.
• [Architecture and Design, Implementation] Understand the context in which your data will be used and the encoding that will be expected. This is especially important when transmitting data between different components, or when generating outputs that can contain multiple encodings at the same time, such as web pages or multi-part mail messages. Study all expected communication protocols and data representations to determine the required encoding strategies.
• [Architecture and Design] In some cases, input validation may be an important strategy when output encoding is not a complete solution. For example, you may be providing the same output that will be processed by multiple consumers that use different encodings or representations. In other cases, you may be required to allow user-supplied input to contain control information, such as limited HTML tags that support formatting in a wiki or bulletin board. When this type of requirement must be met, use an extremely strict allowlist to limit which control sequences can be used. Verify that the resulting syntactic structure is what you expect. Use your normal encoding methods for the remainder of the input.
• [Architecture and Design] Use input validation as a defense-in-depth measure to reduce the likelihood of output encoding errors (see CWE-20).
• [Requirements] Fully specify which encodings are required by components that will be communicating with each other.
• [Implementation] When exchanging data between components, ensure that both components are using the same character encoding. Ensure that the proper encoding is applied at each interface. Explicitly set the encoding you are using whenever the protocol allows you to do so.
Detection methods
• Automated Static Analysis: This weakness can often be detected using automated static analysis tools. Many modern tools use data flow analysis or constraint-based techniques to minimize the number of false positives.
• Automated Dynamic Analysis: This weakness can be detected using dynamic tools and techniques that interact with the software using large test suites with many diverse inputs, such as fuzz testing (fuzzing), robustness testing, and fault injection. The software's operation may slow down, but it should not become unstable, crash, or generate incorrect results.
Observed examples
• CVE-2021-41232: Chain: authentication routine in Go-based agile development product does not escape user name (CWE-116), allowing LDAP injection (CWE-90)
• CVE-2008-4636: OS command injection in backup software using shell metacharacters in a filename; correct behavior would require that this filename could not be changed.
• CVE-2008-0769: Web application does not set the charset when sending a page to a browser, allowing for XSS exploitation when a browser chooses an unexpected encoding.
• CVE-2008-0005: Program does not set the charset when sending a page to a browser, allowing for XSS exploitation when a browser chooses an unexpected encoding.
• CVE-2008-5573: SQL injection via password parameter; a strong password might contain "&"
• CVE-2008-3773: Cross-site scripting in chat application via a message subject, which normally might contain "&" and other XSS-related characters.
• CVE-2008-0757: Cross-site scripting in chat application via a message, which normally might be allowed to contain arbitrary content.
Related
Attack pattern · CAPEC (4)
Observed example · CVE (7)
- CVE-2021-41232 Thunderdome is an open source agile planning poker tool in the theme of Battling for points. vulnerability
- CVE-2008-5573 SQL injection vulnerability in the login feature in Poll Pro 2.0 allows remote attackers to execute arbitrary SQL commands via the (1)… vulnerability
- CVE-2008-4636 yast2-backup 2.14.2 through 2.16.6 on SUSE Linux and Novell Linux allows local users to gain privileges via shell metacharacters in… vulnerability
- CVE-2008-3773 Cross-site scripting (XSS) vulnerability in vBulletin 3.7.2 PL1 and 3.6.10 PL3, when "Show New Private Message Notification Pop-Up" is… vulnerability
- CVE-2008-0769 Cross-site scripting (XSS) vulnerability in Livelink ECM 9.0.0 through 9.7.0 and possibly earlier does not set the charset, which allows… vulnerability
- CVE-2008-0757 Cross-site scripting (XSS) vulnerability in index.php in MercuryBoard 1.1.5 allows remote attackers to inject arbitrary web script or HTML… vulnerability
- CVE-2008-0005 mod_proxy_ftp in Apache 2.2.x before 2.2.7-dev, 2.0.x before 2.0.62-dev, and 1.3.x before 1.3.40-dev does not define a charset, which… vulnerability
Can precede · CWE (1)
- CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component weakness
Child of · CWE (1)
- CWE-707 Improper Neutralization weakness
Referenced by CAPEC · weakness (4)
Referenced by CVE · weakness (586)
- CVE-2026-118256 Vue I18n is the internationalization plugin for Vue.js. vulnerability
- CVE-2026-118257 Vue I18n is the internationalization plugin for Vue.js. vulnerability
- CVE-2026-110910 ### Summary `qs.stringify` with `allowEmptyArrays: true` writes the key of an empty array without encoding it, even though keys are encoded… vulnerability
- CVE-2026-116815 OpenPanel before 3.0.0 contains an improper escaping vulnerability in sankey.service.ts that allows authenticated project members to break… vulnerability
- CVE-2026-116582 Seroval facilitates JavaScript value stringification, including complex structures beyond JSON.stringify capabilities. vulnerability
- CVE-2026-55442 The Goobi viewer is a web application that allows digitised material to be displayed in a web browser. vulnerability
- CVE-2026-57210 Heimdall is a cloud native Identity Aware Proxy and Access Control Decision service. vulnerability
- CVE-2026-114510 Flexible GraphRAG is a Python framework for building graph and retrieval-augmented generation applications across multiple graph, vector,… vulnerability
- CVE-2026-113870 MongoDB Compass improperly escapes certain BSON values when converting a stored view’s aggregation pipeline into editable source. vulnerability
- CVE-2026-14556 The HappyForms WordPress plugin before 1.26.15 does not sanitise or escape a user-controlled referral value before embedding it in the form… vulnerability
- CVE-2026-110725 fast-uri is a dependency-free RFC 3986 URI parser and serializer for Node.js. vulnerability
- CVE-2026-112949 Vitest is a Vite-native testing framework for JavaScript and TypeScript projects. vulnerability
- CVE-2026-113667 ApostropheCMS is an open-source Node.js content management system. vulnerability
- CVE-2026-113725 virtualenv is a tool for creating isolated virtual python environments. vulnerability
- CVE-2026-113726 virtualenv is a tool for creating isolated virtual python environments. vulnerability
- CVE-2026-113732 virtualenv is a tool for creating isolated virtual python environments. vulnerability
- CVE-2026-111059 Mercury is a Python framework for sharing Jupyter notebooks as web applications and dashboards. vulnerability
- CVE-2026-110756 Text::CSV_XS versions before 1.65 for Perl drop the end of a record and its line ending when a UTF-8 flagged field precedes invalid UTF-8… vulnerability
- CVE-2026-110757 Text::CSV_XS versions before 1.65 for Perl allow record splitting by writing strings used as numbers without quotes in combine. vulnerability
- CVE-2026-18516 An output escaping vulnerability in the Audit Logs component of Crafty Controller allows a remote, unauthenticated attacker to perform… vulnerability
- CVE-2026-105429 Improper neutralization of special elements in the NetBird client SSH configuration manager (client/ssh/config/manager.go) in NetBird… vulnerability
- CVE-2026-110592 BottleCRM 0.30 through 1.14.5 contains an HTML injection vulnerability in render_invoice_template() that allows authenticated organization… vulnerability
- CVE-2026-102235 Improper encoding or escaping of output in Visual Studio Code allows an unauthorized attacker to execute code over a network. vulnerability
- CVE-2026-104250 The unstructured library provides open-source components for ingesting and pre-processing images and text documents, such as PDFs, HTML,… vulnerability
- CVE-2026-93693 In Progress ShareFile Storage Zones Controller v5.12.6 and below, improper validation of outbound request destinations and parameters,… vulnerability
- CVE-2026-107823 MariaDB server is a community developed fork of MySQL server. vulnerability
- CVE-2026-107845 Contao is an Open Source CMS. vulnerability
- CVE-2026-107393 FreeScout is a self-hosted help desk and shared mailbox. vulnerability
- CVE-2026-105244 Improper Encoding or Escaping of Output vulnerability in the RemoteSyslogAppender of Apache log4net. vulnerability
- CVE-2026-105801 openapi-python-client generates Python clients from OpenAPI documents. vulnerability