Hard-Coded Credentials in the Client
The desktop client contains credentials, such as a database password or API key, that any user with a copy of the application can extract and reuse.
| Severity | High |
| CVSS 3.1 | 8.1 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N Open in the calculator |
| CVSS 4.0 | 8.6 CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-798: Use of Hard-coded Credentials |
| OWASP Top 10 | A07:2025 Authentication Failures |
| MITRE ATT&CK | T1552.001 Credentials In Files, T1078 Valid Accounts |
| Category | Information Disclosure |
Description
The thick client application contains credentials embedded in its executable files, libraries or bundled configuration files, for example a database connection string with a username and password, a service account password, an API key or a client secret. The same credentials are present in every installed copy, so they are effectively known to every user who has the application, and to anyone who obtains the installer.
Credentials in a client cannot be kept secret from its users. .NET and Java applications decompile to readable source with tools such as dnSpy, ILSpy and JD-GUI, native binaries reveal strings with simple utilities, and configuration files such as app.config are often plain text. Credentials that are encrypted or obfuscated within the client are no better protected, because the client must also contain the key or routine to recover them, and they are visible in memory and often in network traffic whenever the application uses them. Any user of the application, or anyone with a copy of it, can then use them directly against the back-end service, outside the application and its restrictions.
Shared database and service accounts typically have access to all of the application's data, so such use usually means reading and changing every record rather than only the user's own, with the activity attributed to the shared account instead of the individual. The credentials cannot be revoked for one user, and changing them requires a new release to every installation. The weakness is identified by decompiling or extracting strings from the application's files, reviewing its configuration files and observing its connections to back-end services, then confirming that the recovered credentials are accepted by the service they belong to.
Remediation
Remove shared secrets from the client and authenticate each user individually:
- Move access to back-end resources behind a server-side API that authenticates each user, for example with Windows integrated authentication or an OAuth 2.0 flow that issues per-user tokens, and that holds any service credentials itself, out of users' reach.
- Where the client must connect to a database directly, use each user's own Windows account (integrated security) with only the permissions that user needs, rather than a shared SQL login.
- Treat the exposed credentials as compromised: change them, review the service's logs for use from unexpected hosts, and remove them from every released version and from source control.
- Where the client must keep a per-user secret, such as a refresh token, protect it with the operating system's facilities, such as the Windows Data Protection API (DPAPI) with user scope, rather than with a key held in the application.
As an interim measure, reduce the privileges of the embedded account to the minimum the application needs, and restrict which hosts can use it. Confirm the fix by decompiling the new release and confirming that no usable credentials remain.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.