Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

just-bash

Latest version: v3.6.1

Overview

Last scanned
17 Nov 2026
Published
16 Nov 2026
npm package Publisher: cramforce
4,523 Stars
319 Forks
6 Versions
13.8M Downloads
TypeScript Repo language

Scan summary

just-bash was last scanned on 17 Nov 2026 at version 3.6.1. Risk score 45 of 100 (medium). High-severity rules fired.

  • Releases: 6 versions; the latest was published on 16 Nov 2026.
  • Findings: 1 rule fired in version 3.6.1 (2 instances: 2 high). The score describes this version only.
  • Downloads: 13,813,216 downloads.

Versions

6 versions published
Versions and the rules that fired in each
VersionPublishedStatus
3.6.1 LATEST 16 Nov 2026 1 rule fired
3.6.0 1 Oct 2026 No rules fired
3.4.2 22 Aug 2026 No rules fired
3.4.1 19 Aug 2026 Not shown
3.4.0 18 Aug 2026 Not shown

Rules fired in 3.6.1: 1

Findings

2 High

Findings for v3.6.1. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

Encoded data placed in a DNS lookup

A DNS lookup command (nslookup, dig or host) takes its query name from a subshell that first encodes the data, for example with base64 or xxd. Encoding the name turns a lookup into a way to send data to the nameserver of the queried domain. Ordinary diagnostic lookups have no encoding step.

HIGH
Checking access…

🔒 Create a free account to see all 2 findings with descriptions and instance counts

The score describes 3.6.1; other versions have their own rules, not their own score.

Known vulnerabilities

1 CVE · last 15 Sep 2026

0 CRITICAL 1 HIGH 0 MEDIUM 0 LOW

Versions

  • ≥ 3.3.0
  • < 3.3.0 1 HIGH

Vulnerabilities

  • GHSA-G5PF-MH4H-H655 High 15 Sep 2026 just-bash ReadWriteFs allows sandbox escape via pre-existing hard links Fixed in 3.3.0

README

The publisher’s own README, as collected from the registry.

just-bash

A virtual bash environment with an in-memory filesystem, written in TypeScript and designed for AI agents.

Broad support for standard unix commands and bash syntax with optional curl, Python, JS/TS, and sqlite support.

Note: This is beta software. Use at your own risk and please provide feedback. See security model.

Quick Start

npm install just-bash
import { Bash } from "just-bash";

const bash = new Bash();
await bash.exec('echo "Hello" > greeting.txt');
const result = await bash.exec("cat greeting.txt");
console.log(result.stdout); // "Hello\n"
console.log(result.exitCode); // 0

Each exec() call gets its own isolated shell state — environment variables, functions, and working directory reset between calls. The filesystem is shared across calls, so files written in one exec() are visible in the next.

Custom Commands

Extend just-bash with your own TypeScript commands using defineCommand:

import { Bash, decodeBytesToUtf8, defineCommand } from "just-bash";

const hello = defineCommand("hello", async (args, ctx) => {
  const name = args[0] || "world";
  return { stdout: `Hello, ${name}!\n`, stderr: "", exitCode: 0 };
});

const upper = defineCommand("upper", async (args, ctx) => {
  // ctx.stdin is a ByteString — decode to text before string ops.
  return {
    stdout: decodeBytesToUtf8(ctx.stdin).toUpperCase(),
    stderr: "",
    exitCode: 0,
  };
});

const bash = new Bash({ customCommands: [hello, upper] });

await bash.exec("hello Alice"); // "Hello, Alice!\n"
await bash.exec("echo 'test' | upper"); // "TEST\n"

Custom command callbacks receive a ResolvedCommandContext with fs, cwd, env, stdin, resolved limits, and exec (for subcommands), and work with pipes, redirections, and all shell features. The legacy CommandContext remains available for standalone context inputs; use createCommandContext({ fs }) when calling a command directly with a fully resolved context.

Host-provided commands preserve the legacy trusted default whether supplied to the Bash constructor, declared through defineCommand, loaded lazily, or added later with bash.registerCommand(). Set trusted: false (or use defineCommand(name, execute, { trusted: false })) to select the restricted extension boundary. Trusted commands run in the embedding process and should never execute guest-provided JavaScript.

Every invocation is bound by maxExecutionTimeMs. On cancellation, just-bash revokes the command context immediately; maxExtensionCleanupTimeMs only bounds how long it waits for the now-authority-free command promise to settle. A command that is still resolving, such as one whose module is loading, is never started and reports cancellation immediately instead. A late continuation cannot use ctx.fs, ctx.env, ctx.exec, or other context capabilities. Cleanup work that must run at scope closure can be registered with ctx.executionScope.registerCleanup(). A cleanup failure is returned as a generic exit-126 shell result rather than rejecting Bash.exec() or exposing host error details. JavaScript cannot forcibly stop arbitrary host code, so extensions requiring a hard guarantee against external side effects must run in a terminable worker or process. Tests that invoke command objects directly can use createCommandContext({ fs }) to get a fully resolved context without duplicating internal defaults.

File Operations

cat, cp, file, ln, ls, mkdir, mktemp, mv, readlink, rm, rmdir, split, stat, touch, tree

Text Processing

awk, base64, column, comm, cut, diff, expand, fold, grep (+ egrep, fgrep), head, join, md5sum, nl, od, paste, printf, rev, rg, sed, sha1sum, sha256sum, sort, strings, tac, tail, tr, unexpand, uniq, wc, xargs

Data Processing

jq (JSON), sqlite3 (SQLite), xan (CSV), yq (YAML/XML/TOML/CSV)

Optional Runtimes

js-exec (JavaScript/TypeScript via QuickJS; requires javascript: true), python3/python (Python via CPython; requires python: true)

Compression & Archives

gzip (+ gunzip, zcat), tar

Navigation & Environment

basename, cd, dirname, du, echo, env, export, find, hostname, printenv, pwd, tee

Shell Utilities

alias, bash, chmod, clear, date, expr, false, help, history, seq, sh, sleep, time, timeout, true, unalias, which, whoami, yes

Network

curl, html-to-markdown (require network configuration)

All commands support --help for usage information.

Shell Features
  • Pipes: cmd1 | cmd2
  • Redirections: >, >>, 2>, 2>&1, <
  • Command chaining: &&, ||, ;
  • Variables: $VAR, ${VAR}, ${VAR:-default}
  • Positional parameters: $1, $2, $@, $#
  • Glob patterns: *, ?, [...]
  • If statements: if COND; then CMD; elif COND; then CMD; else CMD; fi
  • Functions: function name { ... } or name() { ... }
  • Local variables: local VAR=value
  • Loops: for, while, until
  • Symbolic links: ln -s target link
  • Hard links: ln target link

Ripgrep Compatibility

rg supports ripgrep-style search options, including --line-number --heading --color never, context with -C, file types, globs, per-file match limits, and paths-only output. Use -- before a pattern that starts with -. Heading mode separates files with a blank line and omits the heading for one explicitly named file. Exit codes are 0 for matches, 1 for no matches, and 2 for command/search errors; execution limits remain enforced by the sandbox.

Unlike real ripgrep, rg defaults to smart-case matching: lowercase patterns match case-insensitively. Use -s for case-sensitive matching or -i for case-insensitive matching. All accepted --color choices (never, auto, always, ansi) emit plain text. --max-count 0 selects no matches; omitting the option leaves the match count unlimited within execution limits. Run rg --help for supported options.

Configuration

const env = new Bash({
  files: { "/data/file.txt": "content" }, // Initial files
  env: { MY_VAR: "value" }, // Initial environment
  cwd: "/app", // Starting directory (default: /home/user)
  executionLimits: { maxCallDepth: 50 }, // See "Execution Protection"
  python: true, // Enable python3/python commands
  javascript: true, // Enable js-exec command
  // Or with bootstrap: javascript: { bootstrap: "globalThis.X = 1;" }
});

// Per-exec overrides
await env.exec("echo $TEMP", { env: { TEMP: "value" }, cwd: "/tmp" });

// Pass stdin to the script
await env.exec("cat", { stdin: "hello from stdin\n" });

// Start with a clean environment
await env.exec("env", { replaceEnv: true, env: { ONLY: "this" } });

// Pass arguments without shell escaping (like spawnSync)
await env.exec("grep", { args: ["-r", "TODO", "src/"] });

// Cancel long-running scripts
const controller = new AbortController();
setTimeout(() => controller.abort(), 5000);
await env.exec("while true; do sleep 1; done", { signal: controller.signal });

// Preserve leading whitespace (e.g., for heredocs)
await env.exec("cat <<EOF\n  indented\nEOF", { rawScript: true });
Timezone

date defaults to UTC (%Z=UTC, %z=+0000) regardless of the host clock, so the sandbox does not leak the host timezone. To opt into a specific zone, pass TZ as an initial env var:

const bash = new Bash({ env: { TZ: "America/New_York" } });
await bash.exec("date"); // Mon Jun  1 09:30:00 EDT 2026

-u always forces UTC; an unset or invalid $TZ falls back to UTC. Setting TZ exposes that timezone to scripts running in the sandbox, so only pass a value you are comfortable revealing — forwarding the host's real $TZ (e.g. process.env.TZ) reintroduces the disclosure that the UTC default exists to prevent.

exec() options:

Option Type Description
env Record<string, string> Environment variables for this execution only
cwd string Working directory for this execution only
stdin string Standard input passed to the script
args string[] Additional argv passed directly to the first command (bypasses shell parsing; does not change $1, $2, ...)
replaceEnv boolean Start with empty env instead of merging (default: false)
signal AbortSignal Cooperative cancellation; stops at next statement boundary
rawScript boolean Skip leading-whitespace normalization (default: false)

Filesystem Options

Four filesystem implementations:

InMemoryFs (default) - Pure in-memory filesystem, no disk access:

import { Bash } from "just-bash";

const env = new Bash({
  files: {
    "/data/config.json": '{"key": "value"}',
    // Lazy: called on first read, cached. Never called if written before read.
    "/data/large.csv": () => "col1,col2\na,b\n",
    "/data/remote.txt": async () => (await fetch("https://example.com")).text(),
  },
});

OverlayFs - Copy-on-write over a real directory. Reads come from disk, writes stay in memory:

import { Bash } from "just-bash";
import { OverlayFs } from "just-bash/fs/overlay-fs";

const overlay = new OverlayFs({
  root: "/path/to/project",
  // Copy-on-write data is bounded independently from real-file reads.
  maxMemoryBytes: 256 * 1024 * 1024,
});
const env = new Bash({ fs: overlay, cwd: overlay.getMountPoint() });

await env.exec("cat package.json"); // reads from disk
await env.exec('echo "modified" > package.json'); // stays in memory

maxMemoryBytes defaults to 1 GiB and covers aggregate files retained in the copy-on-write layer, including append chunks. Set it to the deployment's memory budget when an OverlayFs is reused across executions.

ReadWriteFs - Direct read-write access to a real directory. Use this if you want the agent to be able to write to your disk:

import { Bash } from "just-bash";
import { ReadWriteFs } from "just-bash/fs/read-write-fs";

const rwfs = new ReadWriteFs({ root: "/path/to/sandbox" });
const env = new Bash({ fs: rwfs });

await env.exec('echo "hello" > file.txt'); // writes to real filesystem

Keep ReadWriteFs pointed at a workspace directory, not at the installed just-bash package or any other trusted runtime code. Guest-writable roots should stay separate from trusted code.

ReadWriteFs uses normal in-place filesystem operations for private regular files. For multiply-linked regular files, it isolates append and metadata changes by copying the file and replacing only the sandbox directory entry, so a host-created hard link cannot carry those changes beyond the configured root. Implicit copies are limited by maxCopyOnWriteSize (100 MB by default; set it to 0 to disable the limit). Overwrite does not need to copy existing content. Explicit cp copies can be limited with the opt-in maxCopySize option (unlimited by default). The portable copy path may materialize sparse-file holes, so embeddings that require a disk-allocation bound should configure maxCopySize.

Shared-inode isolation has a few deliberate limitations:

  • Append, chmod, and utimes on a multiply-linked regular file require read access to the file and write access to its parent directory. They fail with EFBIG when the file exceeds maxCopyOnWriteSize.
  • Copies use O_NOATIME when the Node.js runtime exposes it and retry with normal read semantics if the kernel returns EPERM. Runtimes and platforms without O_NOATIME may update access-time metadata visible through another hard link.
  • Do not mutate a ReadWriteFs root concurrently through direct host filesystem APIs. Node.js does not expose the descriptor-relative operations needed to make pathname validation atomic against an external actor. A concurrent host append to a multiply-linked file may be lost when the isolated entry is replaced.
  • Mutations in overlapping ReadWriteFs roots are serialized within the process. Unrelated roots proceed independently. The queue is not cancellable or bounded, so a large mutation can delay later operations in overlapping roots even if the requesting script is subsequently aborted.
  • Content writes and appends to FIFOs, sockets, devices, and other special files are rejected. This avoids indefinitely occupying an overlapping-root mutation slot on a blocking special-file open. Metadata operations remain supported for single-link special files; multiply-linked special files are rejected because they cannot be isolated without changing their file type.
  • Private-file and single-link special-file metadata operations use pathname APIs to preserve normal host permission semantics. They are not atomic against a trusted host actor concurrently replacing that pathname with a symlink. With allowSymlinks: false, symlinks present during normal path validation are still rejected.
  • Copying a symlink preserves whether its guest target is absolute or relative. Only symlinks whose resolved targets remain inside the root are copied.
  • Regular-file copies replace the destination entry to prevent writes through hard links. Existing destinations must still be writable, and their parent directory must be writable so the isolated entry can be committed. Thus a writable destination in a non-writable directory cannot be copied over. Copying over a FIFO, socket, device, or other special entry is rejected.

MountableFs - Mount multiple filesystems at different paths. Combines read-only and read-write filesystems into a unified namespace:

import { Bash, MountableFs, InMemoryFs } from "just-bash";
import { OverlayFs } from "just-bash/fs/overlay-fs";
import { ReadWriteFs } from "just-bash/fs/read-write-fs";

const fs = new MountableFs({ base: new InMemoryFs() });

// Mount read-only knowledge base
fs.mount("/mnt/knowledge", new OverlayFs({ root: "/path/to/knowledge", readOnly: true }));

// Mount read-write workspace
fs.mount("/home/agent", new ReadWriteFs({ root: "/path/to/workspace" }));

const bash = new Bash({ fs, cwd: "/home/agent" });

await bash.exec("ls /mnt/knowledge"); // reads from knowledge base
await bash.exec("cp /mnt/knowledge/doc.txt ./"); // cross-mount copy
await bash.exec('echo "notes" > notes.txt'); // writes to workspace

You can also configure mounts in the constructor:

import { MountableFs, InMemoryFs } from "just-bash";
import { OverlayFs } from "just-bash/fs/overlay-fs";
import { ReadWriteFs } from "just-bash/fs/read-write-fs";

const fs = new MountableFs({
  base: new InMemoryFs(),
  mounts: [
    { mountPoint: "/data", filesystem: new OverlayFs({ root: "/shared/data" }) },
    { mountPoint: "/workspace", filesystem: new ReadWriteFs({ root: "/tmp/work" }) },
  ],
});

Optional Capabilities

Network Access

Network access is disabled by default. Enable it with the network option:

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm just-bash

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Copy of Template Design OX Blog (3)
Research

Ruby2Shell: Ruby Memory Corruption Flaws Expose Applications to Remote Code Execution, But is it an Actual Risk?

Microsoft's Official agent framework Hijacked
AI & VibeSec

BREAKING: Hijacked Releases of Microsoft’s Official agent-framework Steals Azure and CI Credentials

Copy of Template Design OX Blog (1)
Research

Thousands Of GitHub Accounts Hijacked With wfx-loot CI Secret Stealing Malware Via GitHub Actions & npm

Frame 2085668439 (1)
Group 1261154229