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

ts-sftp

Latest version: v0.1.3

Overview

Last scanned
13 Aug 2026
Published
13 Aug 2026
npm package Publisher: chrisbreuer
3 Versions

Scan summary

ts-sftp was last scanned on 13 Aug 2026 at version 0.1.3. Risk score 80 of 100 (high). High-severity rules fired.

  • Releases: 3 versions, all published on 13 Aug 2026.
  • Findings: 1 rule fired in version 0.1.3 (1 high). The score describes this version only.

Versions

3 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.1.3 LATEST 13 Aug 2026 1 rule fired
0.1.2 13 Aug 2026 No rules fired
0.1.1 13 Aug 2026 No rules fired

Rules fired in 0.1.3: 1

Findings

1 High

Findings for v0.1.3. 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.

Local file read that may reach a network call in install-time code

A file that the package's install scripts may run reads a local file, and the value read appears to reach an outbound network call. Install-time code does not normally need to upload local files.

HIGH
Checking access…

🔒 Create a free account to see all 1 finding with descriptions and instance counts

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

README

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

ts-sftp

An SFTP server for Bun, with no dependencies.

The SSH transport, key exchange, public key authentication, and the SFTP subsystem are implemented in TypeScript on top of node:crypto — nothing else is installed, nothing native is compiled, and the whole thing runs anywhere Bun runs.

Features

  • SSH transport — curve25519-sha256 key exchange, Ed25519 host keys, aes256-gcm@openssh.com encryption, and OpenSSH's strict KEX extension
  • Public key auth — Ed25519 and RSA (rsa-sha2-256/512) user keys, read straight from authorized_keys lines
  • SFTP v3 — what every client speaks, including the OpenSSH sftp command, FileZilla, Cyberduck, and WinSCP
  • Per-user roots — each user is chrooted to their own directory, with .. resolved inside that namespace so it cannot climb out
  • Pluggable storage — implement SftpFileSystem to serve something other than local disk (object storage, a database, a virtual tree)
  • Read-only mode — per server or per user

Install

bun add ts-sftp

Quick start

Generate a host key and serve a directory:

bunx ts-sftp keygen --out ./host_key
bunx ts-sftp serve --root ./uploads --host-key ./host_key --user deploy:./deploy.pub

Then connect with any client:

sftp -P 2222 -i ~/.ssh/id_ed25519 deploy@localhost

Library

import { SftpServer } from 'ts-sftp'

const server = new SftpServer({
  port: 2222,
  hostKeys: [await Bun.file('./host_key').text()],
  users: {
    deploy: {
      publicKeys: ['ssh-ed25519 AAAAC3Nz... deploy@example.com'],
      root: './uploads',
    },
    viewer: {
      publicKeys: [await Bun.file('./viewer.pub').text()],
      root: './uploads',
      readOnly: true,
    },
  },
})

const { port } = server.listen()
console.log(`listening on ${port}`)
Custom authentication

authenticate runs after the signature has been verified, so a true return means the key is genuine as well as accepted:

const server = new SftpServer({
  authenticate: async ({ username, method, publicKey }) => {
    if (method !== 'publickey' || !publicKey) return false
    return await isEnabled(username, publicKey.comment)
  },
})
Custom storage

Any object implementing SftpFileSystem can back a session — the built-in LocalFileSystem is one implementation, not a requirement:

import type { SftpFileSystem } from 'ts-sftp'
import { SftpServer } from 'ts-sftp'

const server = new SftpServer({
  createFileSystem: ({ username }): SftpFileSystem => bucketBackedFileSystem(username),
})

CLI

ts-sftp serve [options]        Serve a directory over SFTP
ts-sftp keygen [options]       Generate an Ed25519 host key

Serve options:
  --config <path>              Config file (default: sftp.config.ts, if present)
  --port <port>                Port to listen on (default: 2222)
  --host <address>             Address to bind (default: 0.0.0.0)
  --root <dir>                 Directory to serve (default: the working directory)
  --host-key <path>            Host key file. Generated in memory when omitted
  --user <name>:<keys path>    Grant a user access using an authorized_keys file. Repeatable
  --read-only                  Reject every write
  --verbose                    Log each connection and request

Config file

// sftp.config.ts
import { defineConfig } from 'ts-sftp'

export default defineConfig({
  port: 2222,
  root: './uploads',
  users: {
    deploy: { publicKeys: ['ssh-ed25519 AAAAC3Nz... deploy@example.com'] },
  },
})

What it does not do

  • No shells, no exec, no port forwarding — file transfer only, by design
  • No password-by-default: passwords work if you configure one, keys are the path everything else assumes
  • No SFTP v4-v6 extensions; version 3 is what clients negotiate in practice

Testing

The suite includes end-to-end tests that drive the server with the system's own OpenSSH sftp client, covering uploads, downloads, directory operations, and the chroot boundary.

bun test

License

MIT

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 ts-sftp

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

Plug and Pray: Your AI Agents Are Taking Orders From Strangers
Research

Plug and Pray: Your AI Agents Are Taking Orders From Strangers

Microsoft's Official agent framework Hijacked
AI & VibeSec

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

Ethersphere Hijacked With Crypto Stealing Malware (1)
npm

Ethersphere Hijacked With Crypto Stealing Malware Via Github & npm

Frame 2085668439 (1)
Group 1261154229