All posts by rocco

CWE-257 – Storing Passwords in a Recoverable Format

Read Time:45 Second

Description

The storage of passwords in a recoverable format makes them subject to password reuse attacks by malicious users. In fact, it should be noted that recoverable encrypted passwords provide no significant benefit over plaintext passwords since they are subject not only to reuse by malicious attackers but also by malicious insiders. If a system administrator can recover a password directly, or use a brute force search on the available information, the administrator can use the password on other accounts.

Modes of Introduction:

– Architecture and Design

 

Likelihood of Exploit: High

 

Related Weaknesses

CWE-522
CWE-259

 

Consequences

Confidentiality, Access Control: Gain Privileges or Assume Identity

User’s passwords may be revealed.

Access Control: Gain Privileges or Assume Identity

Revealed passwords may be reused elsewhere to impersonate the users in question.

 

Potential Mitigations

Phase: Architecture and Design

Description: 

Use strong, non-reversible encryption to protect stored passwords.

CVE References

CWE-258 – Empty Password in Configuration File

Read Time:45 Second

Description

Using an empty string as a password is insecure.

Modes of Introduction:

– Architecture and Design

 

Likelihood of Exploit: High

 

Related Weaknesses

CWE-260
CWE-521

 

Consequences

Access Control: Gain Privileges or Assume Identity

 

Potential Mitigations

Phase: System Configuration

Description: 

Passwords should be at least eight characters long — the longer the better. Avoid passwords that are in any way similar to other passwords you have. Avoid using words that may be found in a dictionary, names book, on a map, etc. Consider incorporating numbers and/or punctuation into your password. If you do use common words, consider replacing letters in that word with numbers and punctuation. However, do not use “similar-looking” punctuation. For example, it is not a good idea to change cat to c@t, ca+, (@+, or anything similar. Finally, it is never appropriate to use an empty string as a password.

CVE References

CWE-259 – Use of Hard-coded Password

Read Time:1 Minute, 9 Second

Description

The software contains a hard-coded password, which it uses for its own inbound authentication or for outbound communication to external components.

Modes of Introduction:

– Implementation

 

Likelihood of Exploit: High

 

Related Weaknesses

CWE-798
CWE-798
CWE-798
CWE-321
CWE-257

 

Consequences

Access Control: Gain Privileges or Assume Identity

If hard-coded passwords are used, it is almost certain that malicious users will gain access through the account in question.

 

Potential Mitigations

Phase: Architecture and Design

Description: 

For outbound authentication: store passwords 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.

Phase: Architecture and Design

Description: 

For inbound authentication: Rather than hard-code a default username and password for first time logins, utilize a “first login” mode that requires the user to enter a unique strong password.

Phase: Architecture and Design

Description: 

Perform access control checks and limit which entities can access the feature that requires the hard-coded password. For example, a feature might only be enabled through the system console instead of through a network connection.

Phase: Architecture and Design

Description: 

Phase: Architecture and Design

Description: 

CVE References

CWE-22 – Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)

Read Time:4 Minute, 31 Second

Description

The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.

Modes of Introduction:

– Architecture and Design

 

Likelihood of Exploit: High

 

Related Weaknesses

CWE-706
CWE-706
CWE-668

 

Consequences

Integrity, Confidentiality, Availability: Execute Unauthorized Code or Commands

The attacker may be able to create or overwrite critical files that are used to execute code, such as programs or libraries.

Integrity: Modify Files or Directories

The attacker may be able to overwrite or create critical files, such as programs, libraries, or important data. If the targeted file is used for a security mechanism, then the attacker may be able to bypass that mechanism. For example, appending a new account at the end of a password file may allow an attacker to bypass authentication.

Confidentiality: Read Files or Directories

The attacker may be able read the contents of unexpected files and expose sensitive data. If the targeted file is used for a security mechanism, then the attacker may be able to bypass that mechanism. For example, by reading a password file, the attacker could conduct brute force password guessing attacks in order to break into an account on the system.

Availability: DoS: Crash, Exit, or Restart

The attacker may be able to overwrite, delete, or corrupt unexpected critical files such as programs, libraries, or important data. This may prevent the software from working at all and in the case of a protection mechanisms such as authentication, it has the potential to lockout every user of the software.

 

Potential Mitigations

Phase: Implementation

Description: 

Phase: Architecture and Design

Description: 

For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.

Phase: Implementation

Description: 

Phase: Architecture and Design

Description: 

Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.

Phase: Operation

Effectiveness: Moderate

Description: 

Use an application firewall that can detect attacks against this weakness. It can be beneficial in cases in which the code cannot be fixed (because it is controlled by a third party), as an emergency prevention measure while more comprehensive software assurance measures are applied, or to provide defense in depth.

An application firewall might not cover all possible input vectors. In addition, attack techniques might be available to bypass the protection mechanism, such as using malformed inputs that can still be processed by the component that receives those inputs. Depending on functionality, an application firewall might inadvertently reject or modify legitimate requests. Finally, some manual effort may be required for customization.

Phase: Architecture and Design, Operation

Description: 

Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.

Phase: Architecture and Design

Description: 

Phase: Architecture and Design, Operation

Effectiveness: Limited

Description: 

The effectiveness of this mitigation depends on the prevention capabilities of the specific sandbox or jail being used and might only help to reduce the scope of an attack, such as restricting the attacker to certain system calls or limiting the portion of the file system that can be accessed.

Phase: Architecture and Design, Operation

Description: 

Phase: Implementation

Description: 

Phase: Operation, Implementation

Description: 

When using PHP, configure the application so that it does not use register_globals. During implementation, develop the application so that it does not rely on this feature, but be wary of implementing a register_globals emulation that is subject to weaknesses such as CWE-95, CWE-621, and similar issues.

CVE References

  • CVE-2010-0467
    • Newsletter module allows reading arbitrary files using “../” sequences.
  • CVE-2009-4194
    • FTP server allows deletion of arbitrary files using “..” in the DELE command.
  • CVE-2009-4053
    • FTP server allows creation of arbitrary directories using “..” in the MKD command.
  • CVE-2009-0244
    • FTP service for a Bluetooth device allows listing of directories, and creation or reading of files using “..” sequences.
  • CVE-2009-4013
    • Software package maintenance program allows overwriting arbitrary files using “../” sequences.
  • CVE-2009-4449
    • Bulletin board allows attackers to determine the existence of files using the avatar.
  • CVE-2009-4581
    • PHP program allows arbitrary code execution using “..” in filenames that are fed to the include() function.
  • CVE-2010-0013
    • Chat program allows overwriting files using a custom smiley request.
  • CVE-2008-5748
    • Chain: external control of values for user’s desired language and theme enables path traversal.
  • CVE-2009-1936
    • Chain: library file sends a redirect if it is directly requested but continues to execute, allowing remote file inclusion and path traversal.

CWE-220 – Storage of File With Sensitive Data Under FTP Root

Read Time:30 Second

Description

The application stores sensitive data under the FTP server root with insufficient access control, which might make it accessible to untrusted parties.

Various Unix FTP servers require a password file that is under the FTP root, due to use of chroot.

Modes of Introduction:

– Operation

 

 

Related Weaknesses

CWE-552

 

Consequences

Confidentiality: Read Application Data

 

Potential Mitigations

Phase: Implementation, System Configuration

Description: 

Avoid storing information under the FTP root directory.

Phase: System Configuration

Description: 

Access control permissions should be set to prevent reading/writing of sensitive files inside/outside of the FTP directory.

CVE References

CWE-221 – Information Loss or Omission

Read Time:19 Second

Description

The software does not record, or improperly records, security-relevant information that leads to an incorrect decision or hampers later analysis.

This can be resultant, e.g. a buffer overflow might trigger a crash before the product can log the event.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-664

 

Consequences

Non-Repudiation: Hide Activities

 

Potential Mitigations

CVE References

CWE-222 – Truncation of Security-relevant Information

Read Time:35 Second

Description

The application truncates the display, recording, or processing of security-relevant information in a way that can obscure the source or nature of an attack.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-221

 

Consequences

Non-Repudiation: Hide Activities

The source of an attack will be difficult or impossible to determine. This can allow attacks to the system to continue without notice.

 

Potential Mitigations

CVE References

  • CVE-2005-0585
    • Web browser truncates long sub-domains or paths, facilitating phishing.
  • CVE-2004-2032
    • Bypass URL filter via a long URL with a large number of trailing hex-encoded space characters.
  • CVE-2003-0412
    • Does not log complete URI of a long request (truncation).

CWE-223 – Omission of Security-relevant Information

Read Time:34 Second

Description

The application does not record or display information that would be important for identifying the source or nature of an attack, or determining if an action is safe.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-221

 

Consequences

Non-Repudiation: Hide Activities

The source of an attack will be difficult or impossible to determine. This can allow attacks to the system to continue without notice.

 

Potential Mitigations

CVE References

  • CVE-1999-1029
    • Login attempts not recorded if user disconnects before maximum number of tries.
  • CVE-2002-1839
    • Sender’s IP address not recorded in outgoing e-mail.
  • CVE-2000-0542
    • Failed authentication attempt not recorded if later attempt succeeds.

CWE-224 – Obscured Security-relevant Information by Alternate Name

Read Time:21 Second

Description

The software records security-relevant information according to an alternate name of the affected entity, instead of the canonical name.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-221

 

Consequences

Non-Repudiation, Access Control: Hide Activities, Gain Privileges or Assume Identity

 

Potential Mitigations

CVE References

  • CVE-2002-0725
    • Attacker performs malicious actions on a hard link to a file, obscuring the real target file.