Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
Improper Check for Dropped Privileges
This vulnerability occurs when an application tries to lower its system privileges but fails to verify that the operation was successful.
What is CWE-273?
Real-world CVEs caused by CWE-273
-
Program does not check return value when invoking functions to drop privileges, which could leave users with higher privileges than expected by forcing those functions to fail.
-
Program does not check return value when invoking functions to drop privileges, which could leave users with higher privileges than expected by forcing those functions to fail.
Step-by-step attacker path
- 1
Identify a code path that handles untrusted input without validation.
- 2
Craft a payload that exercises the unsafe behavior — injection, traversal, overflow, or logic abuse.
- 3
Deliver the payload through a normal request and observe the application's reaction.
- 4
Iterate until the response leaks data, executes attacker code, or escalates privileges.
Vulnerable C++
This code attempts to take on the privileges of a user before creating a file, thus avoiding performing the action with unnecessarily high privileges:
bool DoSecureStuff(HANDLE hPipe) {
bool fDataWritten = false;
ImpersonateNamedPipeClient(hPipe);
HANDLE hFile = CreateFile(...);
/../
RevertToSelf()
/../
} Secure pseudo
// Validate, sanitize, or use a safe API before reaching the sink.
function handleRequest(input) {
const safe = validateAndEscape(input);
return executeWithGuards(safe);
} How to prevent CWE-273
- Architecture and Design Compartmentalize the system to have "safe" areas where trust boundaries can be unambiguously drawn. Do not allow sensitive data to go outside of the trust boundary and always be careful when interfacing with a compartment outside of the safe area. Ensure that appropriate compartmentalization is built into the system design, and the compartmentalization allows for and reinforces privilege separation functionality. Architects and designers should rely on the principle of least privilege to decide the appropriate time to use privileges and the time to drop privileges.
- Implementation Check the results of all functions that return a value and verify that the value is expected.
- Implementation In Windows, make sure that the process token has the SeImpersonatePrivilege(Microsoft Server 2003). Code that relies on impersonation for security must ensure that the impersonation succeeded, i.e., that a proper privilege demotion happened.
How to detect CWE-273
Plexicus auto-detects CWE-273 and opens a fix PR in under 60 seconds.
Codex Remedium scans every commit, identifies this exact weakness, and ships a reviewer-ready pull request with the patch. No tickets. No hand-offs.
Frequently asked questions
What is CWE-273?
This vulnerability occurs when an application tries to lower its system privileges but fails to verify that the operation was successful.
How serious is CWE-273?
MITRE rates the likelihood of exploit as Medium — exploitation is realistic but typically requires specific conditions.
What languages or platforms are affected by CWE-273?
MITRE has not specified affected platforms for this CWE — it can apply across most application stacks.
How can I prevent CWE-273?
Compartmentalize the system to have "safe" areas where trust boundaries can be unambiguously drawn. Do not allow sensitive data to go outside of the trust boundary and always be careful when interfacing with a compartment outside of the safe area. Ensure that appropriate compartmentalization is built into the system design, and the compartmentalization allows for and reinforces privilege separation functionality. Architects and designers should rely on the principle of least privilege to…
How does Plexicus detect and fix CWE-273?
Plexicus's SAST engine matches the data-flow signature for CWE-273 on every commit. When a match is found, our Codex Remedium agent opens a fix PR with the corrected code, tests, and a one-line summary for the reviewer.
Where can I learn more about CWE-273?
MITRE publishes the canonical definition at https://cwe.mitre.org/data/definitions/273.html. You can also reference OWASP and NIST documentation for adjacent guidance.
Weaknesses related to CWE-273
Improper Check for Unusual or Exceptional Conditions
This weakness occurs when software fails to properly anticipate and handle rare or unexpected runtime situations that fall outside normal…
Unchecked Return Value
This vulnerability occurs when a program fails to verify the result of a function or method call, allowing it to continue execution…
Incorrect Check of Function Return Value
This vulnerability occurs when a program misinterprets or improperly validates the return value from a function, causing it to miss…
Improper Validation of Integrity Check Value
This vulnerability occurs when software fails to properly check the integrity of data by validating its checksum or hash value. Without…
Unchecked Error Condition
This vulnerability occurs when a program fails to properly check or handle error conditions, such as exceptions or return codes. By…
Unexpected Status Code or Return Value
This vulnerability occurs when software fails to properly validate the full range of possible return values from a function or system…
NULL Pointer Dereference
This vulnerability occurs when a program attempts to access or manipulate memory using a pointer that is set to NULL, causing a crash or…
Don't Let Security
Weigh You Down.
Stop choosing between AI velocity and security debt. Plexicus is the only platform that runs Vibe Coding Security and ASPM in parallel — one workflow, every codebase.