CVE-2022-31140: Cuyz/valinor Valinor Error Messages Leading To Vulnerability
HIGHCVE-2022-31140 is a HIGH (CVSS 7.5) valinor error messages leading to vulnerability (CWE-209: Generation of Error Message Containing Sensitive Information) affecting Cuyz/valinor libraries in the Packagist ecosystem. The issue involves valinor error messages leading to potential data exfiltration before v0.12.0. Remediation is available by upgrading affected packages to version 0.12.0.
CVE-2022-31140 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).
How to Fix CVE-2022-31140
To remediate this vulnerability, upgrade all affected Cuyz/valinor dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade cuyz/valinor to 0.12.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for cuyz/valinor
How to Check if You Are Affected
To determine whether your application is affected by CVE-2022-31140, inspect your project dependencies for Cuyz/valinor:
inspect dependencies for cuyz/valinor
Analyze the terminal output to locate any version of Cuyz/valinor in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.12.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-209: Generation of Error Message Containing Sensitive Information, where the product generates an error message that includes sensitive information about its environment, users, or associated data. In Cuyz/valinor, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2022-31140 Affected Cuyz/valinor Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
cuyz/valinor
|
Packagist |
< 0.12.0
|
0.12.0
|
References
Frequently Asked Questions
What is CVE-2022-31140?
Which Cuyz/valinor versions are affected?
What version fixes CVE-2022-31140?
Is cuyz/valinor affected?
What is the CVSS score of CVE-2022-31140?
What CWE is associated with CVE-2022-31140?
How can I check Packagist dependencies for CVE-2022-31140?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-5pgm-3j3g-2rc7",
"modified" : "2022-07-19T22:31:41Z",
"published" : "2022-07-12T22:15:29Z",
"aliases" : [ "CVE-2022-31140" ],
"summary" : "Valinor error messages leading to potential data exfiltration before v0.12.0",
"details" : "```php\n<?php\n\nnamespace My\\App;\n\nuse CuyZ\\Valinor\\Mapper\\MappingError;\nuse CuyZ\\Valinor\\Mapper\\Tree\\Node;\nuse CuyZ\\Valinor\\Mapper\\Tree\\NodeTraverser;\nuse CuyZ\\Valinor\\MapperBuilder;\n\nrequire_once __DIR__ . '/Valinor/vendor/autoload.php';\n\nfinal class Money\n{\n private function __construct(public readonly string $amount)\n {\n }\n\n public static function fromString(string $money): self\n {\n if (1 !== \\preg_match('/^\\d+ [A-Z]{3}$/', $money)) {\n throw new \\InvalidArgumentException(\\sprintf('Given \"%s\" is not a recognized monetary amount', $money));\n }\n \n return new self($money);\n }\n}\n\nclass Foo\n{\n public function __construct(\n private readonly Money $a,\n private readonly Money $b,\n private readonly Money $c,\n ) {}\n}\n\n$mapper = (new MapperBuilder())\n ->registerConstructor([Money::class, 'fromString'])\n ->mapper();\n\ntry {\n var_dump($mapper->map(Foo::class, [\n 'a' => 'HAHA',\n 'b' => '100 EUR',\n 'c' => 'USD 100'\n ]));\n} catch (MappingError $e) {\n $messages = (new NodeTraverser(function (Node $node) {\n foreach ($node->messages() as $message) {\n var_dump([\n '$message',\n $message->path(),\n $message->body()\n ]);\n }\n return '';\n }))->traverse($e->node());\n\n iterator_to_array($messages);\n}\n```\n\nNow, this is quite innocent: it produces following output:\n\n```\n❯ php value-object-conversion.php\narray(3) {\n [0]=>\n string(8) \"$message\"\n [1]=>\n string(1) \"a\"\n [2]=>\n string(48) \"Given \"HAHA\" is not a recognized monetary amount\"\n}\narray(3) {\n [0]=>\n string(8) \"$message\"\n [1]=>\n string(1) \"c\"\n [2]=>\n string(51) \"Given \"USD 100\" is not a recognized monetary amount\"\n}\n```\n\nThe problem is that nowhere I told valinor that it could use `Throwable#getMessage()`.\n\nThis is a problem with cases where you get:\n\n * an SQL exception showing an SQL snippet\n * a DB connection exception showing DB ip address/username/password\n * a timeout detail / out of memory detail (exploring DDoS possibilities)\n\nThis allows for potential data exfiltration, DDoS, enumeration attacks, etc.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "cuyz/valinor"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.12.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/CuyZ/Valinor/security/advisories/GHSA-5pgm-3j3g-2rc7"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31140"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/CuyZ/Valinor"
}, {
"type" : "WEB",
"url" : "https://github.com/CuyZ/Valinor/releases/tag/0.12.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-200", "CWE-209" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-07-12T22:15:29Z",
"nvd_published_at" : "2022-07-11T20:15:00Z"
}
}