Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CWE-547 (使用硬编码、安全相关的常数) — Vulnerability Class 10

10 vulnerabilities classified as CWE-547 (使用硬编码、安全相关的常数). AI Chinese analysis included.

CWE-547 represents a critical software weakness where security-sensitive values, such as encryption keys or access control thresholds, are hardcoded directly into the source code rather than being stored in configurable external files or environment variables. This practice significantly increases the risk of security breaches because updating these constants requires modifying and recompiling the application, which often leads to inconsistent updates across different instances. Attackers exploit this by reverse-engineering the binary to extract these static secrets, bypassing authentication or decrypting sensitive data without needing to compromise the system’s dynamic logic. To mitigate this risk, developers must adopt secure configuration management practices, storing all security-relevant constants in protected, external repositories. This ensures that sensitive values can be rotated or updated independently of the codebase, maintaining flexibility and reducing the attack surface associated with static, embedded credentials.

MITRE CWE Description
The product uses hard-coded constants instead of symbolic names for security-critical values, which increases the likelihood of mistakes during code maintenance or security policy change. If the developer does not find all occurrences of the hard-coded constants, an incorrect policy decision may be made if one of the constants is not changed. Making changes to these values will require code changes that may be difficult or impossible once the system is released to the field. In addition, these hard-coded values may become available to attackers if the code is ever disclosed.
Common Consequences (1)
OtherVaries by Context, Quality Degradation, Reduce Maintainability
The existence of hardcoded constants could cause unexpected behavior and the introduction of weaknesses during code maintenance or when making changes to the code if all occurrences are not modified. The use of hardcoded constants is an indication of poor quality.
Mitigations (1)
ImplementationAvoid using hard-coded constants. Configuration files offer a more flexible solution.
Examples (1)
The usage of symbolic names instead of hard-coded constants is preferred.
char buffer[1024]; ... fgets(buffer, 1024, stdin);
Bad · C
enum { MAX_BUFFER_SIZE = 1024 }; ... char buffer[MAX_BUFFER_SIZE]; ... fgets(buffer, MAX_BUFFER_SIZE, stdin);
Good · C

Vulnerabilities classified as CWE-547 (使用硬编码、安全相关的常数) represent 10 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.