The product defines a public method that reads or modifies a private variable.
If an attacker modifies the variable to contain unexpected values, this could violate assumptions from other parts of the code. Additionally, if an attacker can read the private variable, it may expose sensitive information or make it easier to launch further attacks.
Threat Mapped score: 3.0
Industry: Finiancial
Threat priority: P2 - Serious (High)
N/A
N/A
Phase | Note |
---|---|
Implementation | N/A |
Intro: The following example declares a critical variable to be private, and then allows the variable to be modified by public methods.
private: float price; public: void changePrice(float newPrice) { price = newPrice; }
Intro: The following example could be used to implement a user forum where a single user (UID) can switch between multiple profiles (PID).
Body: The programmer implemented setPID with the intention of modifying the PID variable, but due to a typo. accidentally specified the critical variable UID instead. If the program allows profile IDs to be between 1 and 10, but a UID of 1 means the user is treated as an admin, then a user could gain administrative privileges as a result of this typo.
public class Client { private int UID; public int PID; private String userName; public Client(String userName){ PID = getDefaultProfileID(); UID = mapUserNametoUID( userName ); this.userName = userName; } public void setPID(int ID) { UID = ID; } }