Skip to content

Latest commit

 

History

History
31 lines (18 loc) · 3.22 KB

cwe-798.md

File metadata and controls

31 lines (18 loc) · 3.22 KB

SecurityExplained S-96

CWE-798: Use of Hard-coded Credentials

Hard-coded credentials, such as a password or cryptographic key, are included in the software, which it uses for inbound authentication, outbound communication with external components, and internal data encryption. The flaw exists due to hardcoded passwords, cryptographic keys, tokens, and other authentication credentials that cannot be modified in code.

Hard-coded credentials usually leave a significant gap in the security system, allowing an attacker to bypass the software administrator's authentication. The system administrator may have a hard time detecting this flaw. Even if it is found, fixing it can be challenging. Thus the administrator may be forced to disable the product altogether.

The following are the two primary variations: Inbound: A default administrator account is generated in the Inbound variation, and a simple password is hard-coded into the product and associated with that account. This hard-coded password is the same for each product installation. It usually is impossible for system administrators to change or disable it without directly editing the programme or updating the software. Anyone with knowledge of the password can access the product if it is ever found or released (a typical occurrence on the Internet). Finally, massive attacks like supply-chain attacks will be possible because all programme installations will use the same password, even if they are from different businesses.

  1. Outbound: Front-end systems that authenticate with a back-end service are considered outbound. The back-end service may require a fixed password that can be easily obtained. Those back-end credentials could be hard-coded into the front-end software by the coder. Any user of that programme could extract the password. Client-side systems with hard-coded passwords are considerably more dangerous because extracting a password from a binary is usually highly straightforward.

This problem can affect any software with a management interface or scripting capability.

Mitigations:

If your application has hardcoded credentials that allow unauthorised remote access, you must immediately take action. It is recommended to block access to the impacted URLs or scripts in applications where source code updates are difficult or impossible to make (e.g. credentials are kept in an a.dll file in an ASP.NET application). Store passwords, keys, and other credentials outside of the code in a password-protected, encrypted configuration file or database secured from all outsiders, even other local users on the same machine, for outbound authentication.

For inbound authentication, deploy a "first login" option that requires the user to submit a unique, strong password or key rather than hard-coding a default username and password, key, or other authentication credentials for first-time logins. It's also necessary to set up your Web Application Firewall (WAF) to restrict access to a website if the application receives hardcoded credentials via a request parameter.

A more detailed information about this vulnerability can be found here: https://cwe.mitre.org/data/definitions/798.html

Follow Twitter Thread