CVE-2021-41170: Neoan3 apps/template Insecure Inherited Permissions Vulnerability

HIGH
Advisory Identifier: GHSA-3v56-q6r6-4gcw
CVSS 7.5
CWE-732 CWE-277 CWE-74
Published
Advisory Summary

CVE-2021-41170 is a HIGH (CVSS 7.5) insecure inherited permissions vulnerability (CWE-732: Incorrect Permission Assignment for Critical Resource) affecting Neoan3 apps/template libraries in the Packagist ecosystem. The issue involves insecure inherited permissions in neoan3-apps/template. Remediation is available by upgrading affected packages to version 1.1.1.

CVE-2021-41170 at a Glance

CVE Identifier CVE-2021-41170
GHSA Identifier GHSA-3v56-q6r6-4gcw
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-732: Incorrect Permission Assignment for Critical Resource
Affected Product Neoan3 apps/template
Package Ecosystem Packagist
Published Date
Last Updated

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:N/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2021-41170

To remediate this vulnerability, upgrade all affected Neoan3 apps/template dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

neoan3-apps/template fixed: 1.1.1
Upgrade neoan3-apps/template to 1.1.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for neoan3-apps/template

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-41170, inspect your project dependencies for Neoan3 apps/template:

inspect dependencies for neoan3-apps/template

Analyze the terminal output to locate any version of Neoan3 apps/template in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.1.1), 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-732: Incorrect Permission Assignment for Critical Resource, where the product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors. In Neoan3 apps/template, 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

### Impact Versions 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. In 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. ### Patches Version 1.1.1 has addressed this vulnerability. ```php $params = [ 'reverse' => fn($input) => strrev($input), // <-- no longer possible with version ~1.1.1 'value' => 'My website' ] TemplateFunctions::registerClosure('reverse', fn($input) => strrev($input)); // <-- still possible (and nicely isolated) Template::embrace('<h1>{{reverse(value)}}</h1>', $params); ``` ### Workarounds Unfortunately only working with hardcoded values is safe in prior versions. As this likely defeats the purpose of a template engine, please upgrade. ### References As a possible exploit is relatively easy to achieve, I will not share steps to reproduce the issue for now. ### For more information If you have any questions or comments about this advisory: * Open an issue in [our repo](https://github.com/sroehrl/neoan3-template)

CVE-2021-41170 Affected Neoan3 apps/template Versions

1 component(s)
Fixed Versions:
1.1.1
Product / Package Ecosystem Affected Versions Fixed Version
neoan3-apps/template
Packagist
< 1.1.1
1.1.1

References

Frequently Asked Questions

What is CVE-2021-41170?
CVE-2021-41170 is a security vulnerability in Neoan3 apps/template involving Insecure Inherited Permissions in neoan3-apps/template under CWE-732: Incorrect Permission Assignment for Critical Resource.
Which Neoan3 apps/template versions are affected?
Affected versions include releases prior to 1.1.1 across affected packages: neoan3-apps/template.
What version fixes CVE-2021-41170?
Upgrading to 1.1.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is neoan3-apps/template affected?
Yes, neoan3-apps/template is affected in releases prior to 1.1.1. Upgrade your dependency to 1.1.1 or later.
What is the CVSS score of CVE-2021-41170?
CVE-2021-41170 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2021-41170?
CVE-2021-41170 is classified under CWE-732: Incorrect Permission Assignment for Critical Resource (The product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors.).
How can I check Packagist dependencies for CVE-2021-41170?
Run the dependency tree command: 'inspect dependencies for neoan3-apps/template'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-3v56-q6r6-4gcw",
  "modified" : "2021-11-08T21:04:44Z",
  "published" : "2021-11-10T16:41:08Z",
  "aliases" : [ "CVE-2021-41170" ],
  "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' => fn($input) => strrev($input),    // <-- no longer possible with version ~1.1.1\n   'value' => 'My website' \n]\nTemplateFunctions::registerClosure('reverse', fn($input) => strrev($input));  // <-- still possible (and nicely isolated)\nTemplate::embrace('<h1>{{reverse(value)}}</h1>', $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",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "neoan3-apps/template"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.1.1"
      } ]
    } ]
  } ],
  "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"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-277", "CWE-732", "CWE-74" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-11-08T21:04:44Z",
    "nvd_published_at" : "2021-11-08T19:15:00Z"
  }
}