CWE-547: Use of Hard-coded, Security-relevant Constants
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.
Last updated
Overview
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.
Real-world CVEs
10 recorded CVEs are caused by CWE-547 (Use of Hard-coded, Security-relevant Constants). The highest-severity and most recent are shown first. 1 new CWE-547 CVE has been recorded so far in 2026 (4 in 2025).
- CVE-2023-1712Critical · CVSS 9.8 · EPSS 56th2023-03-30
- CVE-2025-49151
Use of Hard-coded, Security-relevant Constants in MICROSENS NMP Web+
Critical · CVSS 9.3 · EPSS 44th2025-06-25 - CVE-2019-14837Critical · CVSS 9.1 · EPSS 76th2020-01-07
- CVE-2025-2081
Use of Hard-Coded, Security-Relevant Constants
High · CVSS 8.7 · EPSS 31th2025-03-13 - CVE-2025-2079
Use of Hard-Coded, Security-Relevant Constants in Optigo Networks Visual BACnet Capture Tool / Optigo Visual Networks Capture Tool
High · CVSS 8.7 · EPSS 31th2025-03-13 - CVE-2024-39888High · CVSS 8.7 · EPSS 15th2024-07-09
- CVE-2024-32021
Local Git clone may hardlink arbitrary user-readable files into the new repository's "objects/" directory
High · CVSS 7.1 · EPSS 61th2024-05-14 - CVE-2026-28256
Use of Hard-coded Credentials vulnerability in Trane Tracer SC, Tracer SC+, and Tracer Concierge
Medium · CVSS 6.9 · EPSS 18th2026-03-12 - CVE-2024-41885
Hardcoding sensitive information
Medium · CVSS 5.6 · EPSS 8th2024-12-24 - CVE-2025-23253Low · CVSS 2.5 · EPSS 6th2025-04-22
Common consequences
What can happen when CWE-547 is exploited.
Varies by Context, Quality Degradation, Reduce Maintainability
Affects: Other
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.
How it happens
When it is introduced
Typically introduced during these phases of the software lifecycle.
How to prevent it
Practical mitigations for CWE-547, grouped by where in the lifecycle they apply.
Avoid using hard-coded constants. Configuration files offer a more flexible solution.
How to detect it
Automated Static Analysis
Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
Effectiveness: High
Code examples
Illustrative examples from MITRE showing how the weakness appears in code.
The usage of symbolic names instead of hard-coded constants is preferred.
Vulnerable example
char buffer[1024];Safe example
enum { MAX_BUFFER_SIZE = 1024 };Terminology & mappings
Mapped taxonomies
- CERT C Secure Coding: Use meaningful symbolic constants to represent literal values in program logic (DCL06-C)
Frequently asked questions
Common questions about CWE-547.
- What is CWE-547?
- 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.
- What CVEs are caused by CWE-547?
- 10 recorded CVEs are attributed to CWE-547, including CVE-2023-1712, CVE-2025-49151, CVE-2019-14837.
- How do you prevent CWE-547?
- Avoid using hard-coded constants. Configuration files offer a more flexible solution.
- How is CWE-547 detected?
- Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
- What are the consequences of CWE-547?
- Exploiting CWE-547 can lead to: Varies by Context, Quality Degradation, Reduce Maintainability.
- Is CWE-547 actively exploited?
- 10 recorded CVEs are caused by CWE-547; none are currently in CISA's KEV catalog of actively exploited flaws.
References
- MITRE CWE definition (CWE-547) (opens in a new tab)
- CWE-547 vulnerabilities on NVD (opens in a new tab)
- Learn: What is a CWE?
Weakness data is sourced from the MITRE CWE catalog (v4.20). CVE associations are aggregated and kept current by RadicalNotion.AI.
Stay ahead of CWE-547
Get alerted the moment a new CWE-547 vulnerability affects your stack, with AI-written analysis, severity context, and remediation guidance.