# uglify-js@3.19.3 security report (npm)

- Verdict: **Needs review** (risk level: medium)
- Scanned: 2026-10-06T14:24:49.000Z
- Files reviewed: 13
- Findings: 3 medium, 7 low severity findings
- Report: https://security.togoder.click/npm/uglify-js
- Source: Togoder Security (https://security.togoder.click), AI source-code review

## Summary

Togoder Security scanned the npm package uglify-js@3.19.3 on Oct 6, 2026. An AI review of 13 source files produced 3 medium, 7 low severity findings. The overall verdict is medium: the findings flag risky but common patterns (dynamic code, unsafe defaults, broad file or network access) rather than confirmed malware.

## Findings

### [medium] dynamic code execution

Finding ID: `NPS-7420FDA76866`

File: `lib/ast.js:77`

The DEFNODE function uses `new Function(code.join(""))()` to construct AST node constructors from dynamically generated strings. While the generated code is built from internal, developer-controlled strings, this pattern is functionally equivalent to eval and could be abused if the `type`, `props`, or `methods` arguments were ever influenced by untrusted input.

### [medium] Dynamic code execution

Finding ID: `NPS-C40BD02D9BC6`

File: `tools/node.js:17`

Uses new Function() with dynamically concatenated source from local files (lib/*.js). While these are trusted local files, the pattern is a dynamic code execution vector and would become dangerous if the files were tampered with or if input were included.

### [medium] Monkey-patching process.exit

Finding ID: `NPS-E83D181836F9`

File: `tools/tty.js:11`

The code overrides the global process.exit function in a catch block. This modifies core Node.js runtime behavior, which can mask errors, alter application control flow, and potentially interfere with security tooling or sandboxing that relies on standard process termination semantics.

### [low] Dynamic code execution

Finding ID: `NPS-D67DCDBEAF40`

File: `lib/mozilla-ast.js`

The `map()` function uses `new Function()` to dynamically generate AST conversion functions from property map strings. While the generated code is derived from internal hardcoded strings and not external input, the use of `new Function()` is a dynamic code execution pattern that could be exploited if the propmap strings were ever influenced by untrusted input.

### [low] Prototype pollution / unsafe property access

Finding ID: `NPS-DF2FCBDB430C`

File: `lib/mozilla-ast.js`

`VariableDeclaration` uses a computed object lookup `{const: AST_Const, let: AST_Let}[M.kind]` where `M.kind` comes from the Mozilla AST input. If `M.kind` were 'constructor' or '__proto__', this could resolve to Object.prototype properties rather than the intended constructor, potentially leading to unexpected behavior.

### [low] Top-level side effects on import

Finding ID: `NPS-3FCBB4157128`

File: `tools/node.js:17`

Executes code at module load time (the new Function(...)(...)). This is expected for a build tool but still represents import-time execution behavior that should be reviewed in third-party packages.

### [low] File system read

Finding ID: `NPS-B5CC464F2BB1`

File: `tools/node.js:19`

Reads multiple files via fs.readFileSync using require.resolve paths limited to the package's own lib directory. Scope is confined to the package, so risk is low.

### [low] Environment variable read

Finding ID: `NPS-8DEC078609B4`

File: `tools/node.js:30`

Reads process.env['UGLIFY_BUG_REPORT'] and conditionally overrides exports.minify to produce debug output containing source code and options. Not credential harvesting, but reads environment variables at import time.

### [low] Access to internal Node.js stream handles

Finding ID: `NPS-EED82AF87C18`

File: `tools/tty.js:4`

Directly accesses private/internal properties process.stdout._handle and process.stderr._handle and calls setBlocking(true). Reliance on undocumented internals is fragile and could be leveraged to alter I/O behavior in unexpected ways.

### [low] Uncaught exception handler manipulation

Finding ID: `NPS-A16B445A0EB7`

File: `tools/tty.js:13`

Registers a process.once('uncaughtException') handler and then throws the original exit function. This suppresses normal exception propagation and delays process termination based on internal stream buffer state, which could be abused to hide crashes or prolong execution unexpectedly.

## Files reviewed

- `lib/ast.js` (medium): The file is the legitimate UglifyJS AST definition module; it contains one dynamic code generation pattern via new Function, but no data exfiltration, credential harvesting, obfuscated payloads, network calls, or filesystem manipulation were detected.
- `lib/mozilla-ast.js` (medium): UglifyJS's mozilla-ast.js uses `new Function()` for internal code generation and performs some unguarded property lookups, but contains no data exfiltration, credential harvesting, network activity, or backdoor patterns.
- `tools/node.js` (medium): This appears to be the legitimate UglifyJS build/tools script; it uses new Function and reads env vars but shows no clear malicious behavior like exfiltration, credential theft, or process spawning.
- `tools/tty.js` (medium): The file is not overtly malicious but uses fragile internal APIs and monkey-patches process.exit with an uncaughtException handler, which is a suspicious pattern that could be used to manipulate runtime behavior and should be reviewed further.
- `lib/minify.js` (safe): No malicious patterns detected; the code is a standard JavaScript minification library with source map handling and option normalization.
- `lib/output.js` (safe): No malicious patterns detected; the file is the standard output module of the UglifyJS library containing only code generation and formatting logic.
- `lib/parse.js` (safe): UglifyJS's lib/parse.js contains only standard JavaScript tokenizer/parser logic with no malicious patterns detected.
- `lib/propmangle.js` (safe): No malicious patterns detected; this is the standard UglifyJS property mangling module from the official repository.
- `lib/scope.js` (safe): No malicious patterns detected; the code is a legitimate scope analysis module from UglifyJS with no data exfiltration, credential harvesting, dynamic code execution, or other suspicious behavior.
- `lib/sourcemap.js` (safe): Cleared by Jev triage; no further analysis needed
- `lib/transform.js` (safe): No malicious patterns detected; the file contains legitimate AST transformation logic from UglifyJS.
- `lib/utils.js` (safe): Cleared by Jev triage; no further analysis needed
- `tools/exports.js` (safe): Cleared by Jev triage; no further analysis needed

AI analysis is guidance, not a guarantee. Methodology: https://security.togoder.click/methodology
