Skip to content

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

Base

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.

Consequences

  • Other: Varies by Context, Quality Degradation, Reduce Maintainability

How to prevent it

  • Implementation: Avoid using hard-coded constants. Configuration files offer a more flexible solution.

Recent advisories

All advisories for CWE-547

Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor