Skip to content

Insecure Inherited Permissions in neoan3-apps/template

High severity GitHub Reviewed Published Nov 6, 2021 in sroehrl/neoan3-template • Updated Feb 1, 2023

Package

composer neoan3-apps/template (Composer)

Affected versions

< 1.1.1

Patched versions

1.1.1

Description

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.

$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:

References

@sroehrl sroehrl published to sroehrl/neoan3-template Nov 6, 2021
Published by the National Vulnerability Database Nov 8, 2021
Reviewed Nov 8, 2021
Published to the GitHub Advisory Database Nov 10, 2021
Last updated Feb 1, 2023

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

EPSS score

0.245%
(65th percentile)

CVE ID

CVE-2021-41170

GHSA ID

GHSA-3v56-q6r6-4gcw
Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.