Weaknesses of type CWE-838

13 results

Codificação inadequada para contexto de saída

Ocorre quando dados são codificados (ou escapados) de forma incorreta para o contexto onde serão exibidos ou processados. Por exemplo, usar escape HTML em um atributo JavaScript, ou não escapar corretamente strings em SQL. O risco é que o dado malformado seja interpretado de forma não esperada, abrindo brecha para injeção ou bypass de proteções.

Example

Um desenvolvedor tira uma string de um banco de dados e a coloca em um atributo onclick HTML usando apenas htmlspecialchars(), mas não escapa corretamente para contexto JavaScript. Um atacante injeta: '; alert('xss'); // — o escape HTML não é suficiente, e o código JavaScript é executado.

How to mitigate

Use bibliotecas ou funções de escape específicas para cada contexto (HTML, JavaScript, URL, CSS, SQL). Validar entrada e codificar saída de forma contextual: em HTML use htmlspecialchars() com flag ENT_QUOTES; em JavaScript use JSON.stringify() ou bibliotecas especializadas; em SQL use prepared statements. Prefira permitir listas e validação rigorosa sobre confiar apenas em codificação.

CVE-2019-6110MEDIUMIn OpenSSH 7.9, due to accepting and displaying arbitrary stderr output from the server, a malicious server (or Man-in-The-Middle attacker) EPSS 20.9%CVE-2023-6512MEDIUMInappropriate implementation in Web Browser UI in Google Chrome prior to 120.0.6099.62 allowed a remote attacker to potentially spoof the coEPSS 1.3%CVE-2026-55858MEDIUMMariaDB Connector/J: Inappropriate Encoding for Output Context in org.mariadb.jdbc:mariadb-java-clientEPSS 0.9%CVE-2020-7292MEDIUMWeb Gateway (MWG) - Inappropriate Encoding for output contextEPSS 0.9%CVE-2023-3735MEDIUMInappropriate implementation in Web API Permission Prompts in Google Chrome prior to 115.0.5790.98 allowed a remote attacker to obfuscate seEPSS 0.6%CVE-2025-4052CRITICALInappropriate implementation in DevTools in Google Chrome prior to 136.0.7103.59 allowed a remote attacker who convinced a user to engage inEPSS 0.6%CVE-2024-11702HIGHCopying sensitive information from Private Browsing tabs on Android, such as passwords, may have inadvertently stored data in the cloud-baseEPSS 0.5%CVE-2026-55859MEDIUMMariaDB Connector/R2DBC: Inappropriate Encoding for Output Context and Improper Encoding or Escaping of Output in org.mariadb:r2dbc-mariadbEPSS 0.5%CVE-2026-53641MEDIUMFOSSBilling has stored XSS in client email views via unescaped content in JavaScript template literalEPSS 0.4%CVE-2024-34006MEDIUMmoodle: unsanitized HTML in site log for config_log_createdEPSS 0.4%CVE-2023-5770MEDIUMHTML injection in email body through email subjectEPSS 0.3%CVE-2026-47079LOWRound-trip Corruption via Improper Entity Escaping in xml_builderEPSS 0.2%CVE-2026-84463MEDIUMZammad: Stored HTML injection in Knowledge Base video widget enables forced session switching via unescaped iframe attributeEPSS 0.1%