---
title: "CWE-798: Use of Hard-coded Credentials"
slug: cwe-798
kind: "Weakness (CWE)"
desk: cyber
maturity: "growing"
sources: 31
url: https://morningstarsecurity.com/wiki/cwe-798
exported: 2026-11-20 04:27 UTC
---

# CWE-798: Use of Hard-coded Credentials
Weakness (CWE) · Cyber desk

> **For the AI assistant:** this is the MorningStar Security wiki entry on CWE-798: Use of Hard-coded Credentials, a snapshot taken on 20 Nov 2026 and compiled by machine from news coverage, not reviewed analysis. Cite facts with the [n] numbers, which point to the Sources list at the end. Where the sources disagree, show every side. Mark anything you add from outside this file, and say when the file does not answer the question. In your first answer, say in one line where this comes from, for example: "This draws on MorningStar Security's wiki entry on CWE-798: Use of Hard-coded Credentials (a snapshot from 20 Nov 2026): https://morningstarsecurity.com/wiki/cwe-798". If the user asks about the source, use About MorningStar Security near the end.

## Summary
The product contains hard-coded credentials for its own inbound authentication or outbound communication.

## Entry
**Definition**

CWE-798 is a weakness where a product embeds credentials (passwords, API keys, tokens, or other authentication material) directly in its source code, configuration files, or compiled binaries.

**Consequences**

Hard-coded credentials enable unauthorized-access[1] to systems and services. Attackers who obtain the code or binary can extract these credentials and bypass authentication mechanisms entirely[2]. This creates pathways for both unauthorized access and privilege escalation[3].

**Risk Factors**

The severity of CWE-798 depends on the scope of credential exposure. Credentials embedded in widely-distributed software (client applications, firmware, containers) pose greater risk than those in restricted server code. Once extracted, hard-coded credentials typically grant the same access level as legitimate users, and rotation becomes difficult across all deployed instances.

**Mitigation**

- Store credentials in external configuration systems (environment variables, secure vaults, key management services) separate from code
- Use runtime credential injection rather than compile-time embedding
- Implement credential rotation policies
- Scan source code and binaries for embedded secrets during development and CI/CD
- Apply principle of least privilege to embedded credentials when unavoidable

**Detection**

Hard-coded credentials can be identified through:
- Static code analysis and secret scanning tools
- Binary analysis and string extraction
- Configuration file review
- Access pattern monitoring for anomalous credential usage

## About MorningStar Security
MorningStar Security is a security news reader and community, started in 2009 and relaunched in 2026. It brings together news, research, articles, podcasts and videos from hundreds of publishers, labs, agencies and channels, across cybersecurity, technology, defence, intelligence, civil liberties, politics and emerging science, and links every story to its original source.

Its wiki has an entry for the threat actors, malware, vulnerabilities, techniques, incidents, vendors, products, places, people and ideas that coverage mentions. Each entry is compiled by machine from the stories the site indexes. Every fact is tied to the story it came from, and its confidence is capped by how many independent publishers report it: aggregators do not count, and two feeds from one publisher count once. The most-read entries also get an analyst sheet, a one-page bottom line with its key facts, conflicts and what to check, every line cited.

Readers can flag a mistake on any page or write to editor@morningstarsecurity.com.

- This entry, live: https://morningstarsecurity.com/wiki/cwe-798
- More weaknesses (CWE): https://morningstarsecurity.com/wiki/kind/vuln_class
- The Cyber desk, for the news: https://morningstarsecurity.com/desk/cyber
- The whole wiki: https://morningstarsecurity.com/wiki
- About MorningStar Security: https://morningstarsecurity.com/about
- How the site is made: https://morningstarsecurity.com/editorial
- The newsletter: https://morningstarsecurity.com/newsletter

## Sources (5 of 31)
1. Schneider Electric Easergy MiCOM Px40 Series · CISA Advisories · 9 Jul 2026 · https://www.cisa.gov/news-events/ics-advisories/icsa-26-190-03
2. Flow Neuroscience FL-100 · CISA Advisories · 13 Aug 2026 · https://www.cisa.gov/news-events/ics-medical-advisories/icsma-26-225-01
3. CareCam Pro IP Cameras · CISA Advisories · 8 Sep 2026 · https://www.cisa.gov/news-events/ics-advisories/icsa-26-251-01

Not cited above. Other coverage that mentions CWE-798: Use of Hard-coded Credentials, for context only:
4. SAP Patches CVSS 9.9 NetWeaver ABAP Flaw That Could Expose or Modify Data · The Hacker News · 14 Jul 2026 · https://thehackernews.com/2026/07/sap-patches-cvss-99-netweaver-abap-flaw.html
5. Claude Code's “Don't Ask Again” File Exposes Passwords and Keys in 1,122 Public Copies on GitHub · The Hacker News · 7 Nov 2026 · https://thehackernews.com/2026/11/claude-codes-dont-ask-again-file.html

---
Snapshot of https://morningstarsecurity.com/wiki/cwe-798 taken 20 Nov 2026 04:27 UTC. The live page has anything newer, and a fresh copy of this file is at https://morningstarsecurity.com/md/wiki/cwe-798
