CWEweakness

CWE-798 Use of Hard-coded Credentials

High Official page ↗
Abstraction
Base
Structure
Simple
Status
Draft
Likelihood of exploit
High
Languages
Not Language-Specific, Python
CWE version
5.0

Description

The product contains hard-coded credentials, such as a password or cryptographic key.

Common consequences

• Access Control: Bypass Protection Mechanism — If hard-coded passwords are used, it is almost certain that malicious users will gain access to the account in question. Any user of the product that hard-codes passwords may be able to extract the password. Client-side systems with hard-coded passwords pose even more of a threat, since the extraction of a password from a binary is usually very simple. • Integrity, Confidentiality, Availability, Access Control, Other: Read Application Data, Gain Privileges or Assume Identity, Execute Unauthorized Code or Commands, Other — This weakness can lead to the exposure of resources or functionality to unintended actors, possibly providing attackers with sensitive information or even execute arbitrary code. If the password is ever discovered or published (a common occurrence on the Internet), then anybody with knowledge of this password can access the product. Finally, since all installations of the product will have the same password, even across different organizations, this enables massive attacks such as worms to take place.

Potential mitigations

• [Architecture and Design] For outbound authentication: store passwords, keys, and other credentials outside of the code in a strongly-protected, encrypted configuration file or database that is protected from access by all outsiders, including other local users on the same system. Properly protect the key (CWE-320). If you cannot use encryption to protect the file, then make sure that the permissions are as restrictive as possible [REF-7]. In Windows environments, the Encrypted File System (EFS) may provide some protection. • [Architecture and Design] For inbound authentication: Rather than hard-code a default username and password, key, or other authentication credentials for first time logins, utilize a "first login" mode that requires the user to enter a unique strong password or key. • [Architecture and Design] If the product must contain hard-coded credentials or they cannot be removed, perform access control checks and limit which entities can access the feature that requires the hard-coded credentials. For example, a feature might only be enabled through the system console instead of through a network connection. • [Architecture and Design] For inbound authentication using passwords: apply strong one-way hashes to passwords and store those hashes in a configuration file or database with appropriate access control. That way, theft of the file/database still requires the attacker to try to crack the password. When handling an incoming password during authentication, take the hash of the password and compare it to the saved hash. Use randomly assigned salts for each separate hash that is generated. This increases the amount of computation that an attacker needs to conduct a brute-force attack, possibly limiting the effectiveness of the rainbow table method. • [Architecture and Design] For front-end to back-end connections: Three solutions are possible, although none are complete. • The first suggestion involves the use of generated passwords or keys that are changed automatically and must be entered at given time intervals by a system administrator. These passwords will be held in memory and only be valid for the time intervals. • Next, the passwords or keys should be limited at the back end to only performing actions valid for the front end, as opposed to having full access. • Finally, the messages sent should be tagged and checksummed with time sensitive values so as to prevent replay-style attacks.

Detection methods

• Black Box: Credential storage in configuration files is findable using black box methods, but the use of hard-coded credentials for an incoming authentication routine typically involves an account that is not visible outside of the code. • Automated Static Analysis: Automated white box techniques have been published for detecting hard-coded credentials for incoming authentication, but there is some expert disagreement regarding their effectiveness and applicability to a broad range of methods. • Manual Static Analysis: This weakness may be detectable using manual code analysis. Unless authentication is decentralized and applied throughout the product, there can be sufficient time for the analyst to find incoming authentication routines and examine the program logic looking for usage of hard-coded credentials. Configuration files could also be analyzed. • Manual Dynamic Analysis: For hard-coded credentials in incoming authentication: use monitoring tools that examine the product's process as it interacts with the operating system and the network. This technique is useful in cases when source code is unavailable, if the product was not developed by you, or if you want to verify that the build phase did not introduce any new weaknesses. Examples include debuggers that directly attach to the running process; system-call tracing utilities such as truss (Solaris) and strace (Linux); system activity monitors such as FileMon, RegMon, Process Monitor, and other Sysinternals utilities (Windows); and sniffers and protocol analyzers that monitor network traffic. Attach the monitor to the process and perform a login. Using call trees or similar artifacts from the output, examine the associated behaviors and see if any of them appear to be comparing the input to a fixed string or value. • Automated Static Analysis - Binary or Bytecode: According to SOAR [REF-1479], the following detection techniques may be useful: Cost effective for partial coverage: • Bytecode Weakness Analysis - including disassembler + source code weakness analysis • Binary Weakness Analysis - including disassembler + source code weakness analysis • Manual Static Analysis - Binary or Bytecode: According to SOAR [REF-1479], the following detection techniques may be useful: Highly cost effective: • Binary / Bytecode disassembler - then use manual analysis for vulnerabilities & anomalies • Dynamic Analysis with Manual Results Interpretation: According to SOAR [REF-1479], the following detection techniques may be useful: Cost effective for partial coverage: • Network Sniffer • Forced Path Execution • Manual Static Analysis - Source Code: According to SOAR [REF-1479], the following detection techniques may be useful: Highly cost effective: • Focused Manual Spotcheck - Focused manual analysis of source • Manual Source Code Review (not inspections) • Automated Static Analysis - Source Code: According to SOAR [REF-1479], the following detection techniques may be useful: Highly cost effective: • Source code Weakness Analyzer • Context-configured Source Code Weakness Analyzer • Automated Static Analysis: According to SOAR [REF-1479], the following detection techniques may be useful: Cost effective for partial coverage: • Configuration Checker • Architecture or Design Review: According to SOAR [REF-1479], the following detection techniques may be useful: Highly cost effective: • Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.) • Formal Methods / Correct-By-Construction

Observed examples

• CVE-2022-40263: Software for biological cell analysis has hard-coded credentials, leading to leak of Protected Health Information (PHI) • CVE-2022-29953: Condition Monitor firmware has a maintenance interface with hard-coded credentials • CVE-2022-29960: Engineering Workstation uses hard-coded cryptographic keys that could allow for unauthorized filesystem access and privilege escalation • CVE-2022-29964: Distributed Control System (DCS) has hard-coded passwords for local shell access • CVE-2022-30997: Programmable Logic Controller (PLC) has a maintenance service that uses undocumented, hard-coded credentials • CVE-2022-30314: Firmware for a Safety Instrumented System (SIS) has hard-coded credentials for access to boot configuration • CVE-2022-30271: Remote Terminal Unit (RTU) uses a hard-coded SSH private key that is likely to be used in typical deployments • CVE-2021-37555: Telnet service for IoT feeder for dogs and cats has hard-coded password [REF-1288] • CVE-2021-35033: Firmware for a WiFi router uses a hard-coded password for a BusyBox shell, allowing bypass of authentication through the UART port • CVE-2012-3503: Installation script has a hard-coded secret token value, allowing attackers to bypass authentication • CVE-2010-2772: SCADA system uses a hard-coded password to protect back-end database containing authorization information, exploited by Stuxnet worm • CVE-2010-2073: FTP server library uses hard-coded usernames and passwords for three default accounts • CVE-2010-1573: Chain: Router firmware uses hard-coded username and password for access to debug functionality, which can be used to execute arbitrary code • CVE-2008-2369: Server uses hard-coded authentication key • CVE-2008-0961: Backup product uses hard-coded username and password, allowing attackers to bypass authentication via the RPC interface • CVE-2008-1160: Security appliance uses hard-coded password allowing attackers to gain root access • CVE-2006-7142: Drive encryption product stores hard-coded cryptographic keys for encrypted configuration files in executable programs • CVE-2005-3716: VoIP product uses hard-coded public credentials that cannot be changed, which allows attackers to obtain sensitive information • CVE-2005-3803: VoIP product uses hard coded public and private SNMP community strings that cannot be changed, which allows remote attackers to obtain sensitive information • CVE-2005-0496: Backup product contains hard-coded credentials that effectively serve as a back door, which allows remote attackers to access the file system

Related

Attack pattern · CAPEC (2)

  • CAPEC-191 Read Sensitive Constants Within an Executable attack pattern
  • CAPEC-70 Try Common or Default Usernames and Passwords attack pattern

Observed example · CVE (20)

  • CVE-2022-40263 BD Totalys MultiProcessor, versions 1.70 and earlier, contain hardcoded credentials. vulnerability
  • CVE-2022-30314 Honeywell Experion PKS Safety Manager 5.02 uses Hard-coded Credentials. vulnerability
  • CVE-2022-29953 The Bently Nevada 3700 series of condition monitoring equipment through 2022-04-29 has a maintenance interface on port 4001/TCP with… vulnerability
  • CVE-2022-29960 Emerson OpenBSI through 2022-04-29 uses weak cryptography. vulnerability
  • CVE-2022-29964 The Emerson DeltaV Distributed Control System (DCS) controllers and IO cards through 2022-04-29 misuse passwords. vulnerability
  • CVE-2022-30271 The Motorola ACE1000 RTU through 2022-05-02 ships with a hardcoded SSH private key and initialization scripts (such as… vulnerability
  • CVE-2022-30997 Use of hard-coded credentials vulnerability exists in STARDOM FCN Controller and FCJ Controller R4.10 to R4.31, which may allow an attacker… vulnerability
  • CVE-2021-35033 A vulnerability in specific versions of Zyxel NBG6818, NBG7815, WSQ20, WSQ50, WSQ60, and WSR30 firmware with pre-configured password… vulnerability
  • CVE-2021-37555 TX9 Automatic Food Dispenser v3.2.57 devices allow access to a shell as root/superuser, a related issue to CVE-2019-16734. vulnerability
  • CVE-2012-3503 The installation script in Katello 1.0 and earlier does not properly generate the Application.config.secret_token value, which causes each… vulnerability
  • CVE-2010-2772 Siemens Simatic WinCC and PCS 7 SCADA system uses a hard-coded password, which allows local users to access a back-end database and gain… vulnerability
  • CVE-2010-2073 auth_db_config.py in Pyftpd 0.8.4 contains hard-coded usernames and passwords for the (1) test, (2) user, and (3) roxon accounts, which… vulnerability
  • CVE-2010-1573 Linksys WAP54Gv3 firmware 3.04.03 and earlier uses a hard-coded username (Gemtek) and password (gemtekswd) for a debug interface for… vulnerability
  • CVE-2008-2369 manzier.pxt in Red Hat Network Satellite Server before 5.1.1 has a hard-coded authentication key, which allows remote attackers to connect… vulnerability
  • CVE-2008-0961 EMV DiskXtender 6.20.060 has a hard-coded login and password, which allows remote attackers to bypass authentication via the RPC interface. vulnerability
  • CVE-2008-1160 ZyXEL ZyWALL 1050 has a hard-coded password for the Quagga and Zebra processes that is not changed when it is set by a user, which allows… vulnerability
  • CVE-2006-7142 The centralized management feature for Utimaco Safeguard stores hard-coded cryptographic keys in executable programs for encrypted… vulnerability
  • CVE-2005-3803 Cisco IP Phone (VoIP) 7920 1.0(8) contains certain hard-coded ("fixed") public and private SNMP community strings that cannot be changed,… vulnerability
  • CVE-2005-3716 The SNMP daemon in UTStarcom F1000 VOIP WIFI Phone s2.0 running VxWorks 5.5.1 with kernel WIND 2.6 has hard-coded public credentials that… vulnerability
  • CVE-2005-0496 Arkeia Network Backup Client 5.x contains hard-coded credentials that effectively serve as a back door, which allows remote attackers to… vulnerability

Child of · CWE (4)

  • CWE-1391 Use of Weak Credentials weakness
  • CWE-287 Improper Authentication weakness
  • CWE-344 Use of Invariant Value in Dynamically Changing Context weakness
  • CWE-671 Lack of Administrator Control over Security weakness

Peer of · CWE (1)

  • CWE-257 Storing Passwords in a Recoverable Format weakness

Referenced by CAPEC · weakness (2)

  • CAPEC-191 Read Sensitive Constants Within an Executable attack pattern
  • CAPEC-70 Try Common or Default Usernames and Passwords attack pattern

Referenced by CVE · weakness (1,902)

  • CVE-2026-111419 A sensitive information exposure vulnerability exists on the Foxit official website because JavaScript code contains third-party… vulnerability
  • CVE-2026-118601 Alpine iLX-F511 SSH Hard-Coded Credentials Remote Code Execution Vulnerability. vulnerability
  • CVE-2026-18449 The BMC does not correctly enforce integrity and encryption requirements for IPMI commands. vulnerability
  • CVE-2026-54631 Part-DB is an open source inventory management system for electronic components. vulnerability
  • CVE-2026-114219 NT OneAPP developed by NewType Infortech has a Hard-coded Credentials vulnerability. vulnerability
  • CVE-2026-87950 Use of Hard-coded Credentials vulnerability in Drupal SAML SSO - Service Provider allows Retrieve Embedded Sensitive Data. vulnerability
  • CVE-2026-92450 The authentication framework used by affected Kiloview E3 NDI encoder firmware signs session JSON Web Tokens using an HMAC-SHA256 secret… vulnerability
  • CVE-2026-114088 Trigger.dev before 4.5.4 contains a hardcoded default secret vulnerability in the /coordinator Socket.IO namespace that allows… vulnerability
  • CVE-2026-114119 Best Practice Software Bp Premier before 1.14.1.1128 uses a hardcoded Microsoft SQL Server administrative password that is shared across… vulnerability
  • CVE-2026-53986 Girafit camera app (Android and iOS) version 1.9.1 and earlier, and Girafit camera devices, contain a hardcoded credentials vulnerability… vulnerability
  • CVE-2026-76466 A vulnerability in the database service feature of Cisco Expressway Series could allow an unauthenticated, remote attacker with network… vulnerability
  • CVE-2026-109126 IBM Verify Identity Access 11.0.3.1 and IBM Security Verify Access 10.0.9.3 Appliance could allow a physically proximate attacker to gain… vulnerability
  • CVE-2026-112146 A vulnerability was detected in D-Link E15, M32, R15 and R32. vulnerability
  • CVE-2026-107617 An attacker can use a hard-coded credential to log in to EseeCloud devices. vulnerability
  • CVE-2026-105033 The EnergizeLab AI Station (RK3562) firmware image ships with default root credentials and SSH enabled. vulnerability
  • CVE-2026-111281 Jooan JA-A12 IP cameras with firmware 009_20171107 and 05.02.31.105 contain a remote code execution vulnerability that allows… vulnerability
  • CVE-2026-110667 A security flaw has been discovered in cemtan sar2html 4.0.0. vulnerability
  • CVE-2026-77427 FileRise is a self-hosted web-based file manager with multi-file upload, editing, and batch operations. vulnerability
  • CVE-2026-109758 Perforce Helix Authentication Service (HAS) deployments that retain the shipped default SCIM bearer token are vulnerable to unauthorized… vulnerability
  • CVE-2026-53709 MCP Context Forge is an MCP gateway and administrative platform. vulnerability
  • CVE-2026-81964 Use of hard-coded credentials in Windows Update Orchestrator Service allows an authorized attacker to bypass a security feature locally. vulnerability
  • CVE-2026-107437 GV-E-Map Server V18.2.0A contains a plaintext database password embedded within an application component. vulnerability
  • CVE-2026-108831 A security vulnerability has been detected in meetecho janus-gateway up to 1.4.2. vulnerability
  • CVE-2026-109566 Rapyd Admin from 9.0.0 before 9.20.0 contains a hard-coded credentials vulnerability that allows remote unauthenticated attackers to gain… vulnerability
  • CVE-2026-108584 A security flaw has been discovered in FunnyWolf Viper up to 3.1.11. vulnerability
  • CVE-2026-108753 Agnaistic agnai through 1.0.555 contains a hard-coded credentials vulnerability in self-host.docker-compose.yml, which sets a fixed admin… vulnerability
  • CVE-2026-108905 pH7Builder (pH7 Social Dating CMS) before 18.6.0 contains a hard-coded API key vulnerability in Tool.class.php that allows unauthenticated… vulnerability
  • CVE-2026-105278 The published Docker image for openPDC includes a fixed administrative credential with no forced change on first use. vulnerability
  • CVE-2026-32645 Default factory credentials with administrative access are enabled and persist even after configuring other administrator accounts. vulnerability
  • CVE-2026-84250 IBM Guardium Data Protection 12.2 is vulnerable due to weak cryptographic protection and a hard-coded recovery key in the pkcrypto passkey… vulnerability
Show all 1,902 ›

Referenced by CWE · child of (2)

  • CWE-259 Use of Hard-coded Password weakness
  • CWE-321 Use of Hard-coded Cryptographic Key weakness

Referenced by CWE · has member (8)

  • CWE-1200 Weaknesses in the 2019 CWE Top 25 Most Dangerous Software Errors view
  • CWE-1337 Weaknesses in the 2021 CWE Top 25 Most Dangerous Software Weaknesses view
  • CWE-1340 CISQ Data Protection Measures view
  • CWE-1350 Weaknesses in the 2020 CWE Top 25 Most Dangerous Software Weaknesses view
  • CWE-1387 Weaknesses in the 2022 CWE Top 25 Most Dangerous Software Weaknesses view
  • CWE-1425 Weaknesses in the 2023 CWE Top 25 Most Dangerous Software Weaknesses view
  • CWE-1430 Weaknesses in the 2024 CWE Top 25 Most Dangerous Software Weaknesses view
  • CWE-884 CWE Cross-section view

Referenced by OWASP · mapped cwe (2)

  • A07:2025 Authentication Failures Top 10 2025
  • A07:2021 Identification and Authentication Failures Top 10 2021