{"id":"CVE-2022-31140","aliases":["EUVD-2022-6251","GHSA-5pgm-3j3g-2rc7"],"status":"published","title":"Valinor error messages leading to potential data exfiltration","description":"Valinor is a PHP library that helps to map any input into a strongly-typed value object structure. Prior to version 0.12.0, Valinor can use `Throwable#getMessage()` when it should not have permission to do so. This is a problem with cases such as an SQL exception showing an SQL snippet, a database connection exception showing database IP address/username/password, or a timeout detail / out of memory detail. Attackers could use this information for potential data exfiltration, denial of service attacks, enumeration attacks, etc. Version 0.12.0 contains a patch for this vulnerability.","severity":{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","level":"high","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-09","score":0.01486,"percentile":0.74224,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-200","CWE-209"],"published":"2022-07-11T19:55:09Z","modified":"2026-10-28T02:30:24Z","fixes":[{"ecosystem":"Packagist","package":"cuyz/valinor","fixed_in":["0.12.0"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"Packagist","package":"cuyz/valinor","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.12.0"}]}]},{"source":"osv","ecosystem":"Packagist","package":"cuyz/valinor","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.12.0"}]}],"versions":["0.1.0","0.1.1","0.10.0","0.11.0","0.2.0","0.3.0","0.4.0","0.5.0","0.6.0","0.7.0","0.8.0","0.9.0"]}],"products":[{"vendor":"cuyz","product":"valinor"}],"references":[{"url":"https://github.com/CuyZ/Valinor/security/advisories/GHSA-5pgm-3j3g-2rc7","tags":["x_refsource_CONFIRM","x_transferred","Exploit","Third Party Advisory","advisory","web"]},{"url":"https://github.com/CuyZ/Valinor/releases/tag/0.12.0","tags":["x_refsource_MISC","x_transferred","Release Notes","Third Party Advisory","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-31140","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-5pgm-3j3g-2rc7"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/31xxx/CVE-2022-31140.json","tags":["advisory"]},{"url":"https://github.com/CuyZ/Valinor","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2022-31140","title":"Valinor error messages leading to potential data exfiltration","description":"Valinor is a PHP library that helps to map any input into a strongly-typed value object structure. Prior to version 0.12.0, Valinor can use `Throwable#getMessage()` when it should not have permission to do so. This is a problem with cases such as an SQL exception showing an SQL snippet, a database connection exception showing database IP address/username/password, or a timeout detail / out of memory detail. Attackers could use this information for potential data exfiltration, denial of service attacks, enumeration attacks, etc. Version 0.12.0 contains a patch for this vulnerability.","status":"published","published":"2022-07-11T19:55:09Z","modified":"2025-04-22T17:49:30.998Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","level":"high","assessor":"cna"}],"cwes":["CWE-209"],"updated_at":"2026-11-02T14:34:34.940806Z"}],"euvd":[{"id":"EUVD-2022-6251","description":"Valinor is a PHP library that helps to map any input into a strongly-typed value object structure. Prior to version 0.12.0, Valinor can use `Throwable#getMessage()` when it should not have permission to do so. This is a problem with cases such as an SQL exception showing an SQL snippet, a database connection exception showing database IP address/username/password, or a timeout detail / out of memory detail. Attackers could use this information for potential data exfiltration, denial of service attacks, enumeration attacks, etc. Version 0.12.0 contains a patch for this vulnerability.","status":"published","published":"2022-07-11T19:55:09Z","modified":"2025-04-22T17:49:30Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","level":"high"}],"updated_at":"2026-11-02T20:52:15.540112Z"}],"ghsa":[{"id":"GHSA-5pgm-3j3g-2rc7","title":"Valinor error messages leading to potential data exfiltration before v0.12.0","description":"```php\n\u003c?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    -\u003eregisterConstructor([Money::class, 'fromString'])\n    -\u003emapper();\n\ntry {\n    var_dump($mapper-\u003emap(Foo::class, [\n        'a' =\u003e 'HAHA',\n        'b' =\u003e '100 EUR',\n        'c' =\u003e 'USD 100'\n    ]));\n} catch (MappingError $e) {\n    $messages = (new NodeTraverser(function (Node $node) {\n        foreach ($node-\u003emessages() as $message) {\n            var_dump([\n                '$message',\n                $message-\u003epath(),\n                $message-\u003ebody()\n            ]);\n        }\n        return '';\n    }))-\u003etraverse($e-\u003enode());\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]=\u003e\n  string(8) \"$message\"\n  [1]=\u003e\n  string(1) \"a\"\n  [2]=\u003e\n  string(48) \"Given \"HAHA\" is not a recognized monetary amount\"\n}\narray(3) {\n  [0]=\u003e\n  string(8) \"$message\"\n  [1]=\u003e\n  string(1) \"c\"\n  [2]=\u003e\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.","status":"published","published":"2022-07-12T22:15:29Z","modified":"2023-01-27T05:05:44Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","level":"high"}],"cwes":["CWE-200","CWE-209"],"updated_at":"2026-11-02T14:36:21.8171Z"}],"nvd":[{"id":"CVE-2022-31140","description":"Valinor is a PHP library that helps to map any input into a strongly-typed value object structure. Prior to version 0.12.0, Valinor can use `Throwable#getMessage()` when it should not have permission to do so. This is a problem with cases such as an SQL exception showing an SQL snippet, a database connection exception showing database IP address/username/password, or a timeout detail / out of memory detail. Attackers could use this information for potential data exfiltration, denial of service attacks, enumeration attacks, etc. Version 0.12.0 contains a patch for this vulnerability.","status":"published","published":"2022-07-11T20:15:08.747Z","modified":"2026-06-17T04:44:53.38Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","level":"high","assessor":"secondary"},{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical","assessor":"primary"},{"version":"2.0","score":6.4,"vector":"AV:N/AC:L/Au:N/C:P/I:N/A:P","level":"medium","assessor":"primary"}],"cwes":["CWE-209"],"updated_at":"2026-11-02T14:07:23.322724Z"}],"osv":[{"id":"CVE-2022-31140","title":"Valinor error messages leading to potential data exfiltration","description":"Valinor is a PHP library that helps to map any input into a strongly-typed value object structure. Prior to version 0.12.0, Valinor can use `Throwable#getMessage()` when it should not have permission to do so. This is a problem with cases such as an SQL exception showing an SQL snippet, a database connection exception showing database IP address/username/password, or a timeout detail / out of memory detail. Attackers could use this information for potential data exfiltration, denial of service attacks, enumeration attacks, etc. Version 0.12.0 contains a patch for this vulnerability.","status":"published","published":"2022-07-11T19:55:09Z","modified":"2026-10-28T02:30:24.557618626Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","level":"high"}],"cwes":["CWE-209"],"updated_at":"2026-11-02T15:44:25.516981Z"},{"id":"GHSA-5pgm-3j3g-2rc7","title":"Valinor error messages leading to potential data exfiltration before v0.12.0","description":"```php\n\u003c?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    -\u003eregisterConstructor([Money::class, 'fromString'])\n    -\u003emapper();\n\ntry {\n    var_dump($mapper-\u003emap(Foo::class, [\n        'a' =\u003e 'HAHA',\n        'b' =\u003e '100 EUR',\n        'c' =\u003e 'USD 100'\n    ]));\n} catch (MappingError $e) {\n    $messages = (new NodeTraverser(function (Node $node) {\n        foreach ($node-\u003emessages() as $message) {\n            var_dump([\n                '$message',\n                $message-\u003epath(),\n                $message-\u003ebody()\n            ]);\n        }\n        return '';\n    }))-\u003etraverse($e-\u003enode());\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]=\u003e\n  string(8) \"$message\"\n  [1]=\u003e\n  string(1) \"a\"\n  [2]=\u003e\n  string(48) \"Given \"HAHA\" is not a recognized monetary amount\"\n}\narray(3) {\n  [0]=\u003e\n  string(8) \"$message\"\n  [1]=\u003e\n  string(1) \"c\"\n  [2]=\u003e\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.","status":"published","published":"2022-07-12T22:15:29Z","modified":"2023-11-08T04:09:27.300415Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","level":"high"}],"cwes":["CWE-200","CWE-209"],"updated_at":"2026-11-02T15:46:38.553953Z"}]}}
