CWE-547: Use of Hard-coded, Security-relevant Constants

BaseDraft

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.

View on MITRE
Back to CWE Lookup

Extended Description

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.

Technical Details

Structure
Simple

Applicable To

Languages
Platforms

Frequently Asked Questions

What is CWE-547: Use of Hard-coded, Security-relevant Constants?+

CWE-547: Use of Hard-coded, Security-relevant Constants is a Common Weakness Enumeration (CWE) entry maintained by MITRE. 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.

What are the security consequences of Use of Hard-coded, Security-relevant Constants?+

If exploited, CWE-547 (Use of Hard-coded, Security-relevant Constants) it can compromise Other, leading to outcomes such as Varies by Context and Quality Degradation.

How do you prevent or mitigate Use of Hard-coded, Security-relevant Constants?+

Recommended mitigations for CWE-547 include: Avoid using hard-coded constants. Configuration files offer a more flexible solution.

What is the difference between a CWE and a CVE?+

A CWE (Common Weakness Enumeration) like CWE-547 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.

Learn More