CWE-116: Improper Encoding or Escaping of Output

CWE-116 là gì?

CWE-116 là Improper Encoding or Escaping of Output. Lỗi phát sinh khi the product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. Hiện có 153 lỗ hổng trong kho dữ liệu liên quan đến CWE-116 và 1 trong số đó nằm trong danh mục khai thác thực tế của CISA.

Đang phân tích dữ liệu...

THỨ HẠNG OWASP TOP 10:20255 — A05:2025 — Injection
Tổng số CVE liên quan (365 ngày)153
Mức trừu tượngLớp
Khả năng khai thácCao

Số lượng lỗ hổng nằm trong CWE-116

153 lỗ hổngTăng 705% so với cùng kỳ

Số lượng lỗ hổng trong CISA KEV của CWE-116

1 lỗ hổng

Định nghĩa chính thức

TheoMitre CWE

Đặc điểm

Dữ liệu MITRE CWE chính thức

Tên gọi khác

  • Output Sanitization
  • Output Validation
  • Output Encoding

Giai đoạn hình thành

  • Hiện thực hóa
  • Vận hành

Hậu quả thường gặp

Dữ liệu MITRE CWE chính thức
Tác độngPhạm viDiễn giải
Thay đổi dữ liệu ứng dụngTính toàn vẹnThe communications between components can be modified in unexpected ways. Unexpected commands can be executed, bypassing other security mechanisms. Incoming data can be misinterpreted.
Thực thi mã hoặc lệnh trái phépTính toàn vẹn, Tính bí mật, Tính sẵn sàng, Kiểm soát truy cậpThe communications between components can be modified in unexpected ways. Unexpected commands can be executed, bypassing other security mechanisms. Incoming data can be misinterpreted.
Vượt qua cơ chế bảo vệTính bí mậtThe communications between components can be modified in unexpected ways. Unexpected commands can be executed, bypassing other security mechanisms. Incoming data can be misinterpreted.

Biện pháp giảm thiểu rủi ro

Dữ liệu MITRE CWE chính thức
  1. Thư viện hoặc framework · Kiến trúc và thiết kế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.
  2. Tham số hóa · Kiến trúc và thiết kế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.
  3. Kiến trúc và thiết kế, Hiện thực hóaUnderstand 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.
  4. Kiến trúc và thiết kế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.
  5. Kiến trúc và thiết kếUse input validation as a defense-in-depth measure to reduce the likelihood of output encoding errors (see CWE-20).
  6. Yêu cầuFully specify which encodings are required by components that will be communicating with each other.
  7. Hiện thực hóaWhen 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.

Cách phát hiện trong hệ thống

Dữ liệu MITRE CWE chính thức
Phương phápCách làmHiệu quả
Phân tích tĩnh tự độngThis 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.This is not a perfect solution, since 100% accuracy and coverage are not feasible.Khá
Phân tích động tự độngThis 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.-

Lỗ hổng điển hình

Nguồn (2)

CWE™ Program, operated by The MITRE Corporation. Copyright © 2006–2026, The MITRE Corporation. The MITRE Corporation hereby grants you a non-exclusive, royalty-free license to use CWE for research, development, and commercial purposes. CWE Terms of Use.

Tìm hiểu thêm

Kiểm tra chuyên sâu cùng giải pháp quản lý rủi ro Web toàn diện

Giải pháp CyStack VulnScan liên tục phát hiện tài sản, xác minh lỗ hổng và giúp đội ngũ bảo mật ưu tiên khắc phục cho toàn bộ doanh nghiệp.