1. CVE archive
  2. Vulnerability types
  3. CWE-597
CWE-597 · #595 most frequent type in the archive

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.

Part of: CWE-480 · Use of Incorrect Operator

3CVEs of this type in the archive
2critical (CVSS ≥ 9)
0high severity (7–8.9)
Dec 19, 2022latest published

What it is

The product uses the wrong operator when comparing a string, such as using == when the .equals() method should be used instead.

Impact on systems

ScopeImpact
Other Varies by Context
While this weakness often only affects program correctness, if the equality is used for a security decision, the unintended comparison result could be leveraged to affect program security.

How to prevent it

Implementation Within Java, use .equals() to compare string values. Within JavaScript, use == to compare string values. Within PHP, use == to compare a numeric value to a string value. (PHP converts the string to a number.)

Source: MITRE CWE catalog · Official entry on the MITRE website

CWE-597 CVEs published per year
Show the data as a table
YearCVE
20211
20222

All CWE-597 CVEs

3 results

Dottor Marc

Is this type of vulnerability in your systems?

An archive tells you what exists; a Vulnerability Assessment tells you what is exposed on your side. Dottor Marc tests your web applications and network with automated and manual checks.