Privilege Defined With Unsafe Actions

A particular privilege, role, capability, or right can be used to perform unsafe actions that were not intended, even when it is assigned to the correct entity.


Demonstrations

The following examples help to illustrate the nature of this weakness and describe methods or techniques which can be used to mitigate the risk.

Note that the examples here are by no means exhaustive and any given weakness may have many subtle varieties, each of which may require different detection methods or runtime controls.

Example One

This code intends to allow only Administrators to print debug information about a system.

public enum Roles {
  ADMIN,USER,GUEST
}

public void printDebugInfo(User requestingUser){

  if(isAuthenticated(requestingUser)){

    switch(requestingUser.role){

      case GUEST:
        System.out.println("You are not authorized to perform this command");
        break;

      default:
        System.out.println(currentDebugState());
        break;


    }

  }
  else{
    System.out.println("You must be logged in to perform this command");
  }

}

While the intention was to only allow Administrators to print the debug information, the code as written only excludes those with the role of "GUEST". Someone with the role of "ADMIN" or "USER" will be allowed access, which goes against the original intent. An attacker may be able to use this debug information to craft an attack on the system.

See Also

Comprehensive Categorization: Access Control

Weaknesses in this category are related to access control.

Authorize Actors

Weaknesses in this category are related to the design and architecture of a system's authorization components. Frequently these deal with enforcing that agents have th...

SFP Primary Cluster: Privilege

This category identifies Software Fault Patterns (SFPs) within the Privilege cluster (SFP36).

Comprehensive CWE Dictionary

This view (slice) covers all the elements in CWE.

Entries with Maintenance Notes

CWE entries in this view have maintenance notes. Maintenance notes are an indicator that an entry might change significantly in future versions. This view was created...

CWE Cross-section

This view contains a selection of weaknesses that represent the variety of weaknesses that are captured in CWE, at a level of abstraction that is likely to be useful t...


Common Weakness Enumeration content on this website is copyright of The MITRE Corporation unless otherwise specified. Use of the Common Weakness Enumeration and the associated references on this website are subject to the Terms of Use as specified by The MITRE Corporation.