CWE-597
Weakness AllowedUse of Wrong Operator in String Comparison
Abstraction: Variant · Status: Draft
The product uses the wrong operator when comparing a string, such as using "==" when the .equals() method should be used instead.
Mapping guidance
This CWE entry is at the Variant level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.
Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.
Relationships and members
Modes of introduction
Detection methods
Automated Static Analysis
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.)
Effectiveness: High
Content history
updated Potential_Mitigations, Time_of_Introduction
updated Description, Relationships
updated Relationships
updated Demonstrative_Examples
updated Demonstrative_Examples, Description, Potential_Mitigations
updated Common_Consequences, Relationships, Taxonomy_Mappings
updated Demonstrative_Examples, References, Relationships, Taxonomy_Mappings
updated Relationships, Taxonomy_Mappings
updated Taxonomy_Mappings
updated Relationships, Taxonomy_Mappings
updated Relationships
updated Relationships
updated Demonstrative_Examples, Description, Potential_Mitigations, Relationships
updated Detection_Factors, Relationships
updated Mapping_Notes
updated Demonstrative_Examples
updated Applicable_Platforms, Weakness_Ordinalities
updated Background_Details, Common_Consequences, Description, References
4 vulnerabilities reference this CWE, most recent first.
CVE-2022-36072 (GCVE-0-2022-36072)
Vulnerability from cvelistv5 – Published: 2022-09-06 20:45 – Updated: 2025-04-23 17:14- CWE-597 - Use of Wrong Operator in String Comparison
| URL | Tags |
|---|---|
| https://github.com/mesosoi/silverwaregames-io-iss… | x_refsource_CONFIRM |
| Vendor | Product | Version | |
|---|---|---|---|
| mesosoi | silverwaregames-io-issue-tracker |
Affected:
< 1.1.9
|
{
"containers": {
"adp": [
{
"providerMetadata": {
"dateUpdated": "2024-08-03T09:52:00.529Z",
"orgId": "af854a3a-2127-422b-91ae-364da2661108",
"shortName": "CVE"
},
"references": [
{
"tags": [
"x_refsource_CONFIRM",
"x_transferred"
],
"url": "https://github.com/mesosoi/silverwaregames-io-issue-tracker/security/advisories/GHSA-w4wq-7j4q-j2fh"
}
],
"title": "CVE Program Container"
},
{
"metrics": [
{
"other": {
"content": {
"id": "CVE-2022-36072",
"options": [
{
"Exploitation": "none"
},
{
"Automatable": "no"
},
{
"Technical Impact": "partial"
}
],
"role": "CISA Coordinator",
"timestamp": "2025-04-23T14:01:21.380572Z",
"version": "2.0.3"
},
"type": "ssvc"
}
}
],
"providerMetadata": {
"dateUpdated": "2025-04-23T17:14:24.034Z",
"orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
"shortName": "CISA-ADP"
},
"title": "CISA ADP Vulnrichment"
}
],
"cna": {
"affected": [
{
"product": "silverwaregames-io-issue-tracker",
"vendor": "mesosoi",
"versions": [
{
"status": "affected",
"version": "\u003c 1.1.9"
}
]
}
],
"descriptions": [
{
"lang": "en",
"value": "SilverwareGames.io is a social network for users to play video games online. In version 1.1.8 and prior, due to an unobvious feature of PHP, hashes generated by built-in functions and starting with the `0e` symbols were being handled as zero multiplied with the `e` number. Therefore, the hash value was equal to 0. The maintainers fixed this in version 1.1.9 by using `===` instead of `==` in comparisons where it is possible (e.g. on sign in/sign up handlers)."
}
],
"metrics": [
{
"cvssV3_1": {
"attackComplexity": "HIGH",
"attackVector": "NETWORK",
"availabilityImpact": "NONE",
"baseScore": 5.9,
"baseSeverity": "MEDIUM",
"confidentialityImpact": "NONE",
"integrityImpact": "HIGH",
"privilegesRequired": "NONE",
"scope": "UNCHANGED",
"userInteraction": "NONE",
"vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N",
"version": "3.1"
}
}
],
"problemTypes": [
{
"descriptions": [
{
"cweId": "CWE-597",
"description": "CWE-597: Use of Wrong Operator in String Comparison",
"lang": "en",
"type": "CWE"
}
]
}
],
"providerMetadata": {
"dateUpdated": "2022-09-06T20:45:11.000Z",
"orgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
"shortName": "GitHub_M"
},
"references": [
{
"tags": [
"x_refsource_CONFIRM"
],
"url": "https://github.com/mesosoi/silverwaregames-io-issue-tracker/security/advisories/GHSA-w4wq-7j4q-j2fh"
}
],
"source": {
"advisory": "GHSA-w4wq-7j4q-j2fh",
"discovery": "UNKNOWN"
},
"title": "SilverwareGames.io used == for hashing instead of ===",
"x_legacyV4Record": {
"CVE_data_meta": {
"ASSIGNER": "security-advisories@github.com",
"ID": "CVE-2022-36072",
"STATE": "PUBLIC",
"TITLE": "SilverwareGames.io used == for hashing instead of ==="
},
"affects": {
"vendor": {
"vendor_data": [
{
"product": {
"product_data": [
{
"product_name": "silverwaregames-io-issue-tracker",
"version": {
"version_data": [
{
"version_value": "\u003c 1.1.9"
}
]
}
}
]
},
"vendor_name": "mesosoi"
}
]
}
},
"data_format": "MITRE",
"data_type": "CVE",
"data_version": "4.0",
"description": {
"description_data": [
{
"lang": "eng",
"value": "SilverwareGames.io is a social network for users to play video games online. In version 1.1.8 and prior, due to an unobvious feature of PHP, hashes generated by built-in functions and starting with the `0e` symbols were being handled as zero multiplied with the `e` number. Therefore, the hash value was equal to 0. The maintainers fixed this in version 1.1.9 by using `===` instead of `==` in comparisons where it is possible (e.g. on sign in/sign up handlers)."
}
]
},
"impact": {
"cvss": {
"attackComplexity": "HIGH",
"attackVector": "NETWORK",
"availabilityImpact": "NONE",
"baseScore": 5.9,
"baseSeverity": "MEDIUM",
"confidentialityImpact": "NONE",
"integrityImpact": "HIGH",
"privilegesRequired": "NONE",
"scope": "UNCHANGED",
"userInteraction": "NONE",
"vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N",
"version": "3.1"
}
},
"problemtype": {
"problemtype_data": [
{
"description": [
{
"lang": "eng",
"value": "CWE-597: Use of Wrong Operator in String Comparison"
}
]
}
]
},
"references": {
"reference_data": [
{
"name": "https://github.com/mesosoi/silverwaregames-io-issue-tracker/security/advisories/GHSA-w4wq-7j4q-j2fh",
"refsource": "CONFIRM",
"url": "https://github.com/mesosoi/silverwaregames-io-issue-tracker/security/advisories/GHSA-w4wq-7j4q-j2fh"
}
]
},
"source": {
"advisory": "GHSA-w4wq-7j4q-j2fh",
"discovery": "UNKNOWN"
}
}
}
},
"cveMetadata": {
"assignerOrgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
"assignerShortName": "GitHub_M",
"cveId": "CVE-2022-36072",
"datePublished": "2022-09-06T20:45:11.000Z",
"dateReserved": "2022-07-15T00:00:00.000Z",
"dateUpdated": "2025-04-23T17:14:24.034Z",
"state": "PUBLISHED"
},
"dataType": "CVE_RECORD",
"dataVersion": "5.1"
}
CVE-2021-4259 (GCVE-0-2021-4259)
Vulnerability from cvelistv5 – Published: 2022-12-19 00:00 – Updated: 2024-08-03 17:23- CWE-597 - Use of Wrong Operator in String Comparison
| URL | Tags |
|---|---|
| https://vuldb.com/?id.216267 | technical-descriptionvdb-entry |
| https://github.com/erikdubbelboer/phpRedisAdmin/c… | mitigationpatch |
| https://github.com/erikdubbelboer/phpRedisAdmin/r… | mitigation |
| Vendor | Product | Version | |
|---|---|---|---|
| n/a | phpRedisAdmin |
Affected:
1.16.0
Affected: 1.16.1 |
{
"containers": {
"adp": [
{
"providerMetadata": {
"dateUpdated": "2024-08-03T17:23:10.083Z",
"orgId": "af854a3a-2127-422b-91ae-364da2661108",
"shortName": "CVE"
},
"references": [
{
"tags": [
"technical-description",
"vdb-entry",
"x_transferred"
],
"url": "https://vuldb.com/?id.216267"
},
{
"tags": [
"mitigation",
"patch",
"x_transferred"
],
"url": "https://github.com/erikdubbelboer/phpRedisAdmin/commit/31aa7661e6db6f4dffbf9a635817832a0a11c7d9"
},
{
"tags": [
"mitigation",
"x_transferred"
],
"url": "https://github.com/erikdubbelboer/phpRedisAdmin/releases/tag/v1.16.2"
}
],
"title": "CVE Program Container"
}
],
"cna": {
"affected": [
{
"product": "phpRedisAdmin",
"vendor": "n/a",
"versions": [
{
"status": "affected",
"version": "1.16.0"
},
{
"status": "affected",
"version": "1.16.1"
}
]
}
],
"descriptions": [
{
"lang": "en",
"value": "A vulnerability was found in phpRedisAdmin up to 1.16.1. It has been classified as problematic. This affects the function authHttpDigest of the file includes/login.inc.php. The manipulation of the argument response leads to use of wrong operator in string comparison. Upgrading to version 1.16.2 is able to address this issue. The name of the patch is 31aa7661e6db6f4dffbf9a635817832a0a11c7d9. It is recommended to upgrade the affected component. The associated identifier of this vulnerability is VDB-216267."
},
{
"lang": "de",
"value": "Es wurde eine Schwachstelle in phpRedisAdmin bis 1.16.1 ausgemacht. Sie wurde als problematisch eingestuft. Es geht dabei um die Funktion authHttpDigest der Datei includes/login.inc.php. Durch das Manipulieren des Arguments response mit unbekannten Daten kann eine use of wrong operator in string comparison-Schwachstelle ausgenutzt werden. Ein Aktualisieren auf die Version 1.16.2 vermag dieses Problem zu l\u00f6sen. Der Patch wird als 31aa7661e6db6f4dffbf9a635817832a0a11c7d9 bezeichnet. Als bestm\u00f6gliche Massnahme wird das Einspielen eines Upgrades empfohlen."
}
],
"metrics": [
{
"cvssV3_1": {
"baseScore": 5,
"baseSeverity": "MEDIUM",
"vectorString": "CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L",
"version": "3.1"
}
},
{
"cvssV3_0": {
"baseScore": 5,
"baseSeverity": "MEDIUM",
"vectorString": "CVSS:3.0/AV:A/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L",
"version": "3.0"
}
}
],
"problemTypes": [
{
"descriptions": [
{
"cweId": "CWE-597",
"description": "CWE-597 Use of Wrong Operator in String Comparison",
"lang": "en",
"type": "CWE"
}
]
}
],
"providerMetadata": {
"dateUpdated": "2022-12-24T21:16:33.061Z",
"orgId": "1af790b2-7ee1-4545-860a-a788eba489b5",
"shortName": "VulDB"
},
"references": [
{
"tags": [
"technical-description",
"vdb-entry"
],
"url": "https://vuldb.com/?id.216267"
},
{
"tags": [
"mitigation",
"patch"
],
"url": "https://github.com/erikdubbelboer/phpRedisAdmin/commit/31aa7661e6db6f4dffbf9a635817832a0a11c7d9"
},
{
"tags": [
"mitigation"
],
"url": "https://github.com/erikdubbelboer/phpRedisAdmin/releases/tag/v1.16.2"
}
],
"timeline": [
{
"lang": "en",
"time": "2022-12-19T00:00:00.000Z",
"value": "Advisory disclosed"
},
{
"lang": "en",
"time": "2022-12-19T01:00:00.000Z",
"value": "VulDB entry created"
},
{
"lang": "en",
"time": "2022-12-24T15:03:30.000Z",
"value": "VulDB last update"
}
],
"title": "phpRedisAdmin login.inc.php authHttpDigest wrong operator in string comparison"
}
},
"cveMetadata": {
"assignerOrgId": "1af790b2-7ee1-4545-860a-a788eba489b5",
"assignerShortName": "VulDB",
"cveId": "CVE-2021-4259",
"datePublished": "2022-12-19T00:00:00.000Z",
"dateReserved": "2022-12-19T00:00:00.000Z",
"dateUpdated": "2024-08-03T17:23:10.083Z",
"state": "PUBLISHED"
},
"dataType": "CVE_RECORD",
"dataVersion": "5.1"
}
CVE-2021-3797 (GCVE-0-2021-3797)
Vulnerability from cvelistv5 – Published: 2021-09-15 13:05 – Updated: 2024-08-03 17:09- CWE-597 - Use of Wrong Operator in String Comparison
| URL | Tags |
|---|---|
| https://huntr.dev/bounties/c24fb15c-3c84-45c8-af0… | x_refsource_CONFIRM |
| https://github.com/hestiacp/hestiacp/commit/fc68b… | x_refsource_MISC |
| Vendor | Product | Version | |
|---|---|---|---|
| hestiacp | hestiacp/hestiacp |
Affected:
unspecified , ≤ 1.4.13
(custom)
|
{
"containers": {
"adp": [
{
"providerMetadata": {
"dateUpdated": "2024-08-03T17:09:08.816Z",
"orgId": "af854a3a-2127-422b-91ae-364da2661108",
"shortName": "CVE"
},
"references": [
{
"tags": [
"x_refsource_CONFIRM",
"x_transferred"
],
"url": "https://huntr.dev/bounties/c24fb15c-3c84-45c8-af04-a660f8da388f"
},
{
"tags": [
"x_refsource_MISC",
"x_transferred"
],
"url": "https://github.com/hestiacp/hestiacp/commit/fc68baff4f94b59e38316f886d0ce47d337042f7"
}
],
"title": "CVE Program Container"
}
],
"cna": {
"affected": [
{
"product": "hestiacp/hestiacp",
"vendor": "hestiacp",
"versions": [
{
"lessThanOrEqual": "1.4.13",
"status": "affected",
"version": "unspecified",
"versionType": "custom"
}
]
}
],
"descriptions": [
{
"lang": "en",
"value": "hestiacp is vulnerable to Use of Wrong Operator in String Comparison"
}
],
"metrics": [
{
"cvssV3_0": {
"attackComplexity": "HIGH",
"attackVector": "NETWORK",
"availabilityImpact": "NONE",
"baseScore": 4.8,
"baseSeverity": "MEDIUM",
"confidentialityImpact": "LOW",
"integrityImpact": "LOW",
"privilegesRequired": "NONE",
"scope": "UNCHANGED",
"userInteraction": "NONE",
"vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N",
"version": "3.0"
}
}
],
"problemTypes": [
{
"descriptions": [
{
"cweId": "CWE-597",
"description": "CWE-597 Use of Wrong Operator in String Comparison",
"lang": "en",
"type": "CWE"
}
]
}
],
"providerMetadata": {
"dateUpdated": "2021-09-15T13:05:11.000Z",
"orgId": "c09c270a-b464-47c1-9133-acb35b22c19a",
"shortName": "@huntrdev"
},
"references": [
{
"tags": [
"x_refsource_CONFIRM"
],
"url": "https://huntr.dev/bounties/c24fb15c-3c84-45c8-af04-a660f8da388f"
},
{
"tags": [
"x_refsource_MISC"
],
"url": "https://github.com/hestiacp/hestiacp/commit/fc68baff4f94b59e38316f886d0ce47d337042f7"
}
],
"source": {
"advisory": "c24fb15c-3c84-45c8-af04-a660f8da388f",
"discovery": "EXTERNAL"
},
"title": "Use of Wrong Operator in String Comparison in hestiacp/hestiacp",
"x_legacyV4Record": {
"CVE_data_meta": {
"ASSIGNER": "security@huntr.dev",
"ID": "CVE-2021-3797",
"STATE": "PUBLIC",
"TITLE": "Use of Wrong Operator in String Comparison in hestiacp/hestiacp"
},
"affects": {
"vendor": {
"vendor_data": [
{
"product": {
"product_data": [
{
"product_name": "hestiacp/hestiacp",
"version": {
"version_data": [
{
"version_affected": "\u003c=",
"version_value": "1.4.13"
}
]
}
}
]
},
"vendor_name": "hestiacp"
}
]
}
},
"data_format": "MITRE",
"data_type": "CVE",
"data_version": "4.0",
"description": {
"description_data": [
{
"lang": "eng",
"value": "hestiacp is vulnerable to Use of Wrong Operator in String Comparison"
}
]
},
"impact": {
"cvss": {
"attackComplexity": "HIGH",
"attackVector": "NETWORK",
"availabilityImpact": "NONE",
"baseScore": 4.8,
"baseSeverity": "MEDIUM",
"confidentialityImpact": "LOW",
"integrityImpact": "LOW",
"privilegesRequired": "NONE",
"scope": "UNCHANGED",
"userInteraction": "NONE",
"vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N",
"version": "3.0"
}
},
"problemtype": {
"problemtype_data": [
{
"description": [
{
"lang": "eng",
"value": "CWE-597 Use of Wrong Operator in String Comparison"
}
]
}
]
},
"references": {
"reference_data": [
{
"name": "https://huntr.dev/bounties/c24fb15c-3c84-45c8-af04-a660f8da388f",
"refsource": "CONFIRM",
"url": "https://huntr.dev/bounties/c24fb15c-3c84-45c8-af04-a660f8da388f"
},
{
"name": "https://github.com/hestiacp/hestiacp/commit/fc68baff4f94b59e38316f886d0ce47d337042f7",
"refsource": "MISC",
"url": "https://github.com/hestiacp/hestiacp/commit/fc68baff4f94b59e38316f886d0ce47d337042f7"
}
]
},
"source": {
"advisory": "c24fb15c-3c84-45c8-af04-a660f8da388f",
"discovery": "EXTERNAL"
}
}
}
},
"cveMetadata": {
"assignerOrgId": "c09c270a-b464-47c1-9133-acb35b22c19a",
"assignerShortName": "@huntrdev",
"cveId": "CVE-2021-3797",
"datePublished": "2021-09-15T13:05:11.000Z",
"dateReserved": "2021-09-12T00:00:00.000Z",
"dateUpdated": "2024-08-03T17:09:08.816Z",
"state": "PUBLISHED"
},
"dataType": "CVE_RECORD",
"dataVersion": "5.1"
}
GHSA-GMG9-6627-CRJH
Vulnerability from github – Published: 2022-12-19 15:30 – Updated: 2022-12-27 18:30A vulnerability was found in phpRedisAdmin up to 1.17.3. It has been classified as problematic. This affects the function authHttpDigest of the file includes/login.inc.php. The manipulation of the argument response leads to use of wrong operator in string comparison. The name of the patch is 31aa7661e6db6f4dffbf9a635817832a0a11c7d9. It is recommended to apply a patch to fix this issue. The associated identifier of this vulnerability is VDB-216267.
{
"affected": [],
"aliases": [
"CVE-2021-4259"
],
"database_specific": {
"cwe_ids": [
"CWE-597"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2022-12-19T14:15:00Z",
"severity": "CRITICAL"
},
"details": "A vulnerability was found in phpRedisAdmin up to 1.17.3. It has been classified as problematic. This affects the function authHttpDigest of the file includes/login.inc.php. The manipulation of the argument response leads to use of wrong operator in string comparison. The name of the patch is 31aa7661e6db6f4dffbf9a635817832a0a11c7d9. It is recommended to apply a patch to fix this issue. The associated identifier of this vulnerability is VDB-216267.",
"id": "GHSA-gmg9-6627-crjh",
"modified": "2022-12-27T18:30:20Z",
"published": "2022-12-19T15:30:29Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-4259"
},
{
"type": "WEB",
"url": "https://github.com/erikdubbelboer/phpRedisAdmin/commit/31aa7661e6db6f4dffbf9a635817832a0a11c7d9"
},
{
"type": "WEB",
"url": "https://github.com/erikdubbelboer/phpRedisAdmin/releases/tag/v1.16.2"
},
{
"type": "WEB",
"url": "https://vuldb.com/?id.216267"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
Mitigation
- 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.)
No CAPEC attack patterns related to this CWE.