Katalog CWE

CWE-547 · Słabość

Use of Hard-coded, Security-relevant Constants

Abstrakcja
Bazowa
Status
Szkic
Dodano
19 lipca 2006
Ostatnia zmiana
11 grudnia 2025

Podatności CVE z tą słabościąPełny wpis na cwe.mitre.org ↗

Opis

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.

Skutki

  • Other

    Varies 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.

Zapobieganie

  • Implementation

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

Słabość nadrzędna

Kiedy powstaje

Dotyczy

Not Language-Specific

Wpis z katalogu CWE 4.20.