CWEweakness

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

Official page ↗
Abstraction
Base
Structure
Simple
Status
Draft
Languages
Not Language-Specific
CWE version
5.0

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.

Common consequences

• 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. In addition, these hard-coded values may become available to attackers if the code is ever disclosed.

Potential mitigations

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

Detection methods

• 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.)

Related

Child of · CWE (1)

  • CWE-1078 Inappropriate Source Code Style or Formatting weakness

Referenced by CVE · weakness (11)

  • CVE-2026-28256 A Use of Hard-coded, Security-relevant Constants vulnerability in Trane Tracer SC, Tracer SC+, and Tracer Concierge could allow an attacker… vulnerability
  • CVE-2025-49151 The affected products could allow an unauthenticated attacker to generate forged JSON Web Tokens (JWT) to bypass authentication. vulnerability
  • CVE-2025-23253 NVIDIA NvContainer service for Windows contains a vulnerability in its usage of OpenSSL, where an attacker could exploit a hard-coded… vulnerability
  • CVE-2025-30206 Dpanel is a Docker visualization panel system which provides complete Docker management functions. vulnerability
  • CVE-2025-2079 Optigo Networks Visual BACnet Capture Tool and Optigo Visual Networks Capture Tool version 3.1.2rc11 contain a hard coded secret key. vulnerability
  • CVE-2025-2081 Optigo Networks Visual BACnet Capture Tool and Optigo Visual Networks Capture Tool version 3.1.2rc11 are vulnerable to an attacker… vulnerability
  • CVE-2024-41885 Team ENVY, a Security Research TEAM has found a flaw that allows for a remote code execution on the NVR. vulnerability
  • CVE-2024-39888 A vulnerability has been identified in Mendix Encryption (All versions >= V10.0.0 < V10.0.2). vulnerability
  • CVE-2024-32021 Git is a revision control system. vulnerability
  • CVE-2023-1712 Use of Hard-coded, Security-relevant Constants in GitHub repository deepset-ai/haystack prior to 0.1.30. vulnerability
  • CVE-2019-14837 A flaw was found in keycloack before version 8.0.0. vulnerability

Referenced by CWE · has member (1)

Referenced by OWASP · mapped cwe (2)

  • A02:2025 Security Misconfiguration Top 10 2025
  • A05:2021 Security Misconfiguration Top 10 2021