Every CVE Search/ Get API key

CVE-2022-21704

Incorrect Default Permissions in log4js-node

5.5 MediumFix available

log4js-node is a port of log4js to node.js. In affected versions default file permissions for log files created by the file, fileSync and dateFile appenders are world-readable (in unix). This could cause problems if log files contain sensitive information. This would affect any users that have not supplied their own permissions for the files via the mode parameter in the config. Users are advised to update.

Attack profile

How easy it is to exploit

Attack vector
Local
Complexity
Low
Privileges needed
Low
User interaction
None

What an attacker can affect

Confidentiality
High
Integrity
None
Availability
None

Exploit likelihood

0.30%Down 0.7 points since Feb 8, 2022
90%50%10%1%

What each source reports

CVE List Score used 5.5

Incorrect Default Permissions in log4js-node

log4js-node is a port of log4js to node.js. In affected versions default file permissions for log files created by the file, fileSync and dateFile appenders are world-readable (in unix). This could cause problems if log files contain sensitive information. This would affect any users that have not supplied their own permissions for the files via the mode parameter in the config. Users are advised to update.

Record
CVE-2022-21704
CVSS 3.1
5.5 MediumCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-276
Updated
2026-11-02
EUVDEUVD-2022-0513 5.5

log4js-node is a port of log4js to node.js. In affected versions default file permissions for log files created by the file, fileSync and dateFile appenders are world-readable (in unix). This could cause problems if log files contain sensitive information. This would affect any users that have not supplied their own permissions for the files via the mode parameter in the config. Users are advised to update.

Record
EUVD-2022-0513
CVSS 3.1
5.5 MediumCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Updated
2026-11-02
GitHub AdvisoriesGHSA-2cf5-4w76-r9qv 7.3

Arbitrary Code Execution in handlebars

Versions of handlebars prior to 3.0.8 or 4.5.2 are vulnerable to Arbitrary Code Execution. The package's lookup helper fails to properly validate templates, allowing attackers to submit templates that execute arbitrary JavaScript in the system. It can be used to run arbitrary code in a server processing Handlebars templates or on a victim's browser (effectively serving as Cross-Site Scripting).

The following template can be used to demonstrate the vulnerability:

	{{#with split as |a|}}
		{{pop (push "alert('Vulnerable Handlebars JS');")}}
		{{#with (concat (lookup join (slice 0 1)))}}
			{{#each (slice 2 3)}}
				{{#with (apply 0 a)}}
					{{.}}
				{{/with}}
			{{/each}}
		{{/with}}
	{{/with}}
{{/with}}```


## Recommendation

Upgrade to version 3.0.8, 4.5.2 or later.
Record
GHSA-2cf5-4w76-r9qv
CVSS 3.1
7.3 HighCVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:L/I:H/A:L
Weakness
CWE-94
Updated
2026-11-02
GitHub AdvisoriesGHSA-82v2-mx6x-wq7q 5.5

Incorrect Default Permissions in log4js

Impact

Default file permissions for log files created by the file, fileSync and dateFile appenders are world-readable (in unix). This could cause problems if log files contain sensitive information. This would affect any users that have not supplied their own permissions for the files via the mode parameter in the config.

Patches

Fixed by:

Released to NPM in [email protected]

Workarounds

Every version of log4js published allows passing the mode parameter to the configuration of file appenders, see the documentation for details.

References

Thanks to ranjit-git for raising the issue, and to @lamweili for fixing the problem.

For more information

If you have any questions or comments about this advisory:

Record
GHSA-82v2-mx6x-wq7q
CVSS 3.1
5.5 MediumCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-276
Updated
2026-11-02
GitHub AdvisoriesGHSA-q42p-pg8m-cqh6 7.3

Prototype Pollution in handlebars

Versions of handlebars prior to 4.0.14 are vulnerable to Prototype Pollution. Templates may alter an Objects' prototype, thus allowing an attacker to execute arbitrary code on the server.

Recommendation

For handlebars 4.1.x upgrade to 4.1.2 or later. For handlebars 4.0.x upgrade to 4.0.14 or later.

Record
GHSA-q42p-pg8m-cqh6
CVSS 3.1
7.3 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
Weakness
CWE-471
Updated
2026-11-02
GitHub AdvisoriesGHSA-g9r4-xpmj-mj65 No score

Prototype Pollution in handlebars

Versions of handlebars prior to 3.0.8 or 4.5.3 are vulnerable to prototype pollution. It is possible to add or modify properties to the Object prototype through a malicious template. This may allow attackers to crash the application or execute Arbitrary Code in specific conditions.

Recommendation

Upgrade to version 3.0.8, 4.5.3 or later.

Record
GHSA-g9r4-xpmj-mj65
Weakness
CWE-1321
Updated
2026-11-02
Show 21 moreShow less
GitHub AdvisoriesGHSA-q2c6-c6pm-g3gh No score

Arbitrary Code Execution in handlebars

Versions of handlebars prior to 3.0.8 or 4.5.3 are vulnerable to Arbitrary Code Execution. The package's lookup helper fails to properly validate templates, allowing attackers to submit templates that execute arbitrary JavaScript in the system. It is due to an incomplete fix for a previous issue. This vulnerability can be used to run arbitrary code in a server processing Handlebars templates or on a victim's browser (effectively serving as Cross-Site Scripting).

Recommendation

Upgrade to version 3.0.8, 4.5.3 or later.

Record
GHSA-q2c6-c6pm-g3gh
Updated
2026-11-02
NVD 5.5

log4js-node is a port of log4js to node.js. In affected versions default file permissions for log files created by the file, fileSync and dateFile appenders are world-readable (in unix). This could cause problems if log files contain sensitive information. This would affect any users that have not supplied their own permissions for the files via the mode parameter in the config. Users are advised to update.

Record
CVE-2022-21704
CVSS 3.1
5.5 MediumCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
CVSS 2.0
2.1 LowAV:L/AC:L/Au:N/C:P/I:N/A:N
Weakness
CWE-276
Updated
2026-11-02
OSVAZL-45261 5.5

CVE-2022-21704 affecting package js-jquery 3.5.0-4

log4js-node is a port of log4js to node.js. In affected versions default file permissions for log files created by the file, fileSync and dateFile appenders are world-readable (in unix). This could cause problems if log files contain sensitive information. This would affect any users that have not supplied their own permissions for the files via the mode parameter in the config. Users are advised to update.

Record
AZL-45261
CVSS 3.1
5.5 MediumCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Updated
2026-11-05
OSV 5.5

Incorrect Default Permissions in log4js-node

log4js-node is a port of log4js to node.js. In affected versions default file permissions for log files created by the file, fileSync and dateFile appenders are world-readable (in unix). This could cause problems if log files contain sensitive information. This would affect any users that have not supplied their own permissions for the files via the mode parameter in the config. Users are advised to update.

Record
CVE-2022-21704
CVSS 3.1
5.5 MediumCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-276
Updated
2026-11-02
OSVGHSA-2cf5-4w76-r9qv 7.3

Arbitrary Code Execution in handlebars

Versions of handlebars prior to 3.0.8 or 4.5.2 are vulnerable to Arbitrary Code Execution. The package's lookup helper fails to properly validate templates, allowing attackers to submit templates that execute arbitrary JavaScript in the system. It can be used to run arbitrary code in a server processing Handlebars templates or on a victim's browser (effectively serving as Cross-Site Scripting).

The following template can be used to demonstrate the vulnerability:

	{{#with split as |a|}}
		{{pop (push "alert('Vulnerable Handlebars JS');")}}
		{{#with (concat (lookup join (slice 0 1)))}}
			{{#each (slice 2 3)}}
				{{#with (apply 0 a)}}
					{{.}}
				{{/with}}
			{{/each}}
		{{/with}}
	{{/with}}
{{/with}}```


## Recommendation

Upgrade to version 3.0.8, 4.5.2 or later.
Record
GHSA-2cf5-4w76-r9qv
CVSS 3.1
7.3 HighCVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:L/I:H/A:L
Weakness
CWE-94
Updated
2026-11-02
OSVGHSA-82v2-mx6x-wq7q 5.5

Incorrect Default Permissions in log4js

Impact

Default file permissions for log files created by the file, fileSync and dateFile appenders are world-readable (in unix). This could cause problems if log files contain sensitive information. This would affect any users that have not supplied their own permissions for the files via the mode parameter in the config.

Patches

Fixed by:

Released to NPM in [email protected]

Workarounds

Every version of log4js published allows passing the mode parameter to the configuration of file appenders, see the documentation for details.

References

Thanks to ranjit-git for raising the issue, and to @lamweili for fixing the problem.

For more information

If you have any questions or comments about this advisory:

Record
GHSA-82v2-mx6x-wq7q
CVSS 3.1
5.5 MediumCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-276
Updated
2026-11-02
OSVGHSA-q42p-pg8m-cqh6 7.3

Prototype Pollution in handlebars

Versions of handlebars prior to 4.0.14 are vulnerable to Prototype Pollution. Templates may alter an Objects' prototype, thus allowing an attacker to execute arbitrary code on the server.

Recommendation

For handlebars 4.1.x upgrade to 4.1.2 or later. For handlebars 4.0.x upgrade to 4.0.14 or later.

Record
GHSA-q42p-pg8m-cqh6
CVSS 3.1
7.3 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
Weakness
CWE-471
Updated
2026-11-02
OSVUBUNTU-CVE-2022-21704 5.5

log4js-node is a port of log4js to node.js. In affected versions default file permissions for log files created by the file, fileSync and dateFile appenders are world-readable (in unix). This could cause problems if log files contain sensitive information. This would affect any users that have not supplied their own permissions for the files via the mode parameter in the config. Users are advised to update.

Record
UBUNTU-CVE-2022-21704
CVSS 3.1
5.5 MediumCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Updated
2026-11-02
OSVCLSA-2026-1772583203 No score

TuxCare security update for log4js (1 CVE)

TuxCare rebuilt log4js to address 1 CVE. Fixed in 4.5.1-tuxcare.1.

Record
CLSA-2026-1772583203
Updated
2026-11-02
OSVCLSA-2026-1774743817 No score

TuxCare security update for handlebars (1 CVE)

TuxCare rebuilt handlebars to address 1 CVE. Fixed in 1.3.0-tuxcare.1.

Record
CLSA-2026-1774743817
Updated
2026-11-02
OSVCLSA-2026-1774743830 No score

TuxCare security update for handlebars (3 CVEs)

TuxCare rebuilt handlebars to address 3 CVEs. Fixed in 1.0.12-tuxcare.2.

Record
CLSA-2026-1774743830
Updated
2026-11-02
OSVCLSA-2026-1786731948 No score

TuxCare security update for dompurify (34 CVEs)

TuxCare rebuilt dompurify to address 34 CVEs. Fixed in 3.0.3-tuxcare.1.

Record
CLSA-2026-1786731948
Updated
2026-11-02
OSVCLSA-2026-1788553383 No score

TuxCare security update for log4js (1 CVE)

TuxCare rebuilt log4js to address 1 CVE. Fixed in 3.0.3-tuxcare.1.

Record
CLSA-2026-1788553383
Updated
2026-11-02
OSVCLSA-2026-1792473187 No score

TuxCare security update for log4js (1 CVE)

TuxCare rebuilt log4js to address 1 CVE. Fixed in 0.6.38-tuxcare.1.

Record
CLSA-2026-1792473187
Updated
2026-11-02
OSVDEBIAN-CVE-2022-21704 No score

log4js-node is a port of log4js to node.js. In affected versions default file permissions for log files created by the file, fileSync and dateFile appenders are world-readable (in unix). This could cause problems if log files contain sensitive information. This would affect any users that have not supplied their own permissions for the files via the mode parameter in the config. Users are advised to update.

Record
DEBIAN-CVE-2022-21704
Updated
2026-11-03
OSVGHSA-g9r4-xpmj-mj65 No score

Prototype Pollution in handlebars

Versions of handlebars prior to 3.0.8 or 4.5.3 are vulnerable to prototype pollution. It is possible to add or modify properties to the Object prototype through a malicious template. This may allow attackers to crash the application or execute Arbitrary Code in specific conditions.

Recommendation

Upgrade to version 3.0.8, 4.5.3 or later.

Record
GHSA-g9r4-xpmj-mj65
Weakness
CWE-1321
Updated
2026-11-02
OSVGHSA-q2c6-c6pm-g3gh No score

Arbitrary Code Execution in handlebars

Versions of handlebars prior to 3.0.8 or 4.5.3 are vulnerable to Arbitrary Code Execution. The package's lookup helper fails to properly validate templates, allowing attackers to submit templates that execute arbitrary JavaScript in the system. It is due to an incomplete fix for a previous issue. This vulnerability can be used to run arbitrary code in a server processing Handlebars templates or on a victim's browser (effectively serving as Cross-Site Scripting).

Recommendation

Upgrade to version 3.0.8, 4.5.3 or later.

Record
GHSA-q2c6-c6pm-g3gh
Updated
2026-11-02
OSVROOT-APP-NPM-GHSA-2cf5-4w76-r9qv No score

GHSA-2cf5-4w76-r9qv in handlebars - Patched by Root

Root has patched GHSA-2cf5-4w76-r9qv in the handlebars package for Root:npm. Multiple fixed versions available.

Record
ROOT-APP-NPM-GHSA-2cf5-4w76-r9qv
Updated
2026-11-02
OSVROOT-APP-NPM-GHSA-g9r4-xpmj-mj65 No score

GHSA-g9r4-xpmj-mj65 in handlebars - Patched by Root

Root has patched GHSA-g9r4-xpmj-mj65 in the handlebars package for Root:npm. Multiple fixed versions available.

Record
ROOT-APP-NPM-GHSA-g9r4-xpmj-mj65
Updated
2026-11-02
OSVROOT-APP-NPM-GHSA-q2c6-c6pm-g3gh No score

GHSA-q2c6-c6pm-g3gh in handlebars - Patched by Root

Root has patched GHSA-q2c6-c6pm-g3gh in the handlebars package for Root:npm. Multiple fixed versions available.

Record
ROOT-APP-NPM-GHSA-q2c6-c6pm-g3gh
Updated
2026-11-02
OSVROOT-APP-NPM-GHSA-q42p-pg8m-cqh6 No score

GHSA-q42p-pg8m-cqh6 in handlebars - Patched by Root

Root has patched GHSA-q42p-pg8m-cqh6 in the handlebars package for Root:npm. Multiple fixed versions available.

Record
ROOT-APP-NPM-GHSA-q42p-pg8m-cqh6
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
handlebars
npm
before 3.0.8
3.0.8
handlebars
npm
4.0.0 up to 4.5.2
4.5.2
log4js
npm
before 6.4.0
6.4.0
handlebars
npm
4.0.0 up to 4.5.3
4.5.3
handlebars
npm
4.1.0 up to 4.1.2
4.1.2
handlebars
npm
4.0.0 up to 4.0.14
4.0.14
handlebars
npm
before 3.0.7
3.0.7
js-jquery
Azure Linux:3
through 3.5.0-4 None known
log4js
TuxCare:npm
4.5.1-tuxcare.0 up to 4.5.1-tuxcare.1, plus listed versions
4.5.1
4.5.1-tuxcare.1
handlebars
TuxCare:npm
1.3.0-tuxcare.0 up to 1.3.0-tuxcare.1, plus listed versions
1.3.0
1.3.0-tuxcare.1
Show 14 moreShow less
Affected packages
PackageAffectedFixed
handlebars
TuxCare:npm
1.0.12-tuxcare.0 up to 1.0.12-tuxcare.2, plus listed versions
1.0.121.0.12-tuxcare.1
1.0.12-tuxcare.2
log4js
TuxCare:npm
3.0.3-tuxcare.0 up to 3.0.3-tuxcare.1, plus listed versions
3.0.3
3.0.3-tuxcare.1
log4js
TuxCare:npm
0.6.38-tuxcare.0 up to 0.6.38-tuxcare.1, plus listed versions
0.6.38
0.6.38-tuxcare.1
node-log4js
Debian:12
before 6.4.1+~cs8.3.5-1
6.4.1+~cs8.3.5-1
node-log4js
Debian:13
before 6.4.1+~cs8.3.5-1
6.4.1+~cs8.3.5-1
node-log4js
Debian:14
before 6.4.1+~cs8.3.5-1
6.4.1+~cs8.3.5-1
node-log4js
Debian:10
before 4.0.2-2+deb10u1, plus listed versions
4.0.2-2
4.0.2-2+deb10u1
handlebars
Root:npm
before 3.0.7-aikido.3
3.0.7-aikido.33.0.3-aikido.23.0.8-aikido.13.0.8-aikido.2
@rootio/handlebars
Root:npm
before 3.0.7-root.io.3
3.0.7-root.io.33.0.3-root.io.23.0.8-root.io.13.0.8-root.io.2
handlebars
Root:npm
before 3.0.3-aikido.2
3.0.3-aikido.23.0.7-aikido.13.0.7-aikido.23.0.7-aikido.3
@rootio/handlebars
Root:npm
before 3.0.3-root.io.2
3.0.3-root.io.23.0.7-root.io.13.0.7-root.io.23.0.7-root.io.3
node-log4js
Ubuntu:16.04:LTS
All versions, plus listed versions
0.6.18-1
None known
node-log4js
Ubuntu:18.04:LTS
All versions, plus listed versions
0.6.18-1
None known
node-log4js
Ubuntu:20.04:LTS
All versions, plus listed versions
4.5.1-35.2.1-16.1.0-1
None known

History

History
RecordedChangedSources
factsOSV
affected
first indexedCVE List, EUVD, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2022-21704 is a medium vulnerability (CVSS 5.5) in Log4js-node, published June 5, 2019. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.30%, the 22nd percentile. Fixed in handlebars 3.0.8.

References

Show 21 moreShow less
MoveEnter Open