{"id":"GHSA-3v56-q6r6-4gcw","summary":"Insecure Inherited Permissions in neoan3-apps/template","details":"### Impact\nVersions prior 1.1.1 have allowed for passing in closures directly into the template engine. As a result values that are callable are executed by the template engine. The issue arises if a value has the same name as a method or function in scope and can therefore be executed either by mistake or maliciously. \n\nIn theory all users of the package are affected as long as they either deal with direct user input or database values. A multi-step attack on is therefore plausible. \n\n\n### Patches\nVersion 1.1.1 has addressed this vulnerability. \n```php\n$params = [\n   'reverse' =\u003e fn($input) =\u003e strrev($input),    // \u003c-- no longer possible with version ~1.1.1\n   'value' =\u003e 'My website' \n]\nTemplateFunctions::registerClosure('reverse', fn($input) =\u003e strrev($input));  // \u003c-- still possible (and nicely isolated)\nTemplate::embrace('\u003ch1\u003e{{reverse(value)}}\u003c/h1\u003e', $params);\n```\n\n### Workarounds\nUnfortunately only working with hardcoded values is safe in prior versions. As this likely defeats the purpose of a template engine, please upgrade.\n\n### References\nAs a possible exploit is relatively easy to achieve, I will not share steps to reproduce the issue for now.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [our repo](https://github.com/sroehrl/neoan3-template)\n\n","aliases":["CVE-2021-41170"],"modified":"2026-05-07T05:01:57.156992232Z","published":"2021-11-10T16:41:08Z","database_specific":{"github_reviewed":true,"github_reviewed_at":"2021-11-08T21:04:44Z","nvd_published_at":"2021-11-08T19:15:00Z","cwe_ids":["CWE-277","CWE-732","CWE-74"],"severity":"HIGH"},"references":[{"type":"WEB","url":"https://github.com/sroehrl/neoan3-template/security/advisories/GHSA-3v56-q6r6-4gcw"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-41170"},{"type":"WEB","url":"https://github.com/sroehrl/neoan3-template/issues/8"},{"type":"WEB","url":"https://github.com/sroehrl/neoan3-template/commit/4a2c9570f071d3c8f4ac790007599cba20e16934"},{"type":"PACKAGE","url":"https://github.com/sroehrl/neoan3-template"}],"affected":[{"package":{"name":"neoan3-apps/template","ecosystem":"Packagist","purl":"pkg:composer/neoan3-apps/template"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.1.1"}]}],"versions":["1.0.0","1.0.1","1.0.2","1.0.3","1.0.4","1.0.5","1.1.0"],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2021/11/GHSA-3v56-q6r6-4gcw/GHSA-3v56-q6r6-4gcw.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"}]}