CWE-597: Use of Wrong Operator in String Comparison
The product uses the wrong operator when comparing a string, such as using "==" when the .equals() method should be used instead.
Last updated
Overview
CWE-597 (Use of Wrong Operator in String Comparison) is a variant-level software weakness catalogued by MITRE in the Common Weakness Enumeration (CWE). It describes a recurring type of mistake that can lead to exploitable security vulnerabilities.
Background
In Java, using == or != to compare two strings for equality actually compares two objects for equality rather than their string values for equality. Chances are good that the two references will never be equal.
Real-world CVEs
3 recorded CVEs are caused by CWE-597 (Use of Wrong Operator in String Comparison). The highest-severity and most recent are shown first.