Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ RUST_BACKTRACE=full
# public feeds (OSV + CISA's KEV catalog) and alert once per package and CVE.
# Refreshed at least daily, which is what catches newly published CVEs.
#STACKDOG_CVE_WATCH_ENABLED=true
# NGINX2Root (CVE-2026-123007 and four more, 2026-11-18): flag nginx builds
# older than the fixes whose config reaches one of the five CVEs (HTTP/2,
# HTTP/3, mail proxy, resolver), and flag a loaded kernel SCTP module -- the
# unpatched step of the root-escalation chain. Alert only; neither names a
# client address. `web.worker-exec` (a web worker that runs a program) is the
# RCE tell, and reads eBPF syscall events when that collector is enabled.
#STACKDOG_NGINX2ROOT_ENABLED=true
#STACKDOG_KERNEL_SCTP_ENABLED=true

# ---------------------------------------------------------------------------
# Dashboard container (docker-compose.yml / docker-compose.app.yml)
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- NGINX2Root exposure (CVE-2026-123007, CVE-2026-123633, CVE-2026-123634,
CVE-2026-121810, CVE-2026-113425): `vuln.nginx2root` flags nginx builds older
than 1.30.7 (stable) / 1.31.9 (mainline) whose config reaches one of the five
CVEs — HTTP/2, HTTP/3, the mail proxy, or `proxy_pass` with a variable plus an
SSI/mirror subrequest. It reads `NGINX_VERSION` from official images and the
package databases, follows nginx's two version tracks, and names the CVE, the
feature and the mitigation. `nginx.worker-crash` alerts on a run of nginx
workers dying on memory faults. `kernel.sctp-exposed` alerts when the Linux
`sctp` module is loaded — the unpatched kernel step of the root-escalation
chain. `web.worker-exec` alerts when a web-server worker executes a program,
the RCE end state (reads eBPF syscall events, which `serve` does not yet
collect). `kernel.sctp-socket` alerts when a web worker or container process
creates an SCTP socket — the first step of the kernel root-escalation.
`nginx.http2-spray` is a workload-level heuristic that flags a container whose
inbound bytes grew while its logged request count stayed small, the footprint
of the HTTP/2 heap spray. The eBPF collector now traces `socket()` as well, so
SCTP socket creation is captured alongside execve/connect/openat/ptrace. None
of these name a client address, so none ban.
`STACKDOG_NGINX2ROOT_ENABLED` and `STACKDOG_KERNEL_SCTP_ENABLED` toggle them.

## [0.3.1] - 2026-11-13

### Added
Expand Down
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,40 @@ vendor's advisory". Very fresh CVEs may not be in the feeds yet; the
specialized detectors above cover the ones we know in detail.
`STACKDOG_CVE_WATCH_ENABLED=false` turns it off.

#### NGINX2Root exposure (CVE-2026-123007 and four more)

NGINX2Root is a set of five memory-corruption bugs in nginx (disclosed
2026-11-18) plus an unpatched Linux kernel SCTP use-after-free that escalates
the nginx worker to root, including out of a Docker container. Each nginx bug is
reachable only when a feature is on, so exposure is configuration, not just
version. Fixed in nginx 1.30.7 (stable) and 1.31.9 (mainline).

| Finding | When | Action |
|---|---|---|
| `vuln.nginx2root` | an nginx build older than the fixes whose config reaches one of the five CVEs: HTTP/2 (CVE-2026-123007, CVE-2026-123633), HTTP/3/QUIC (CVE-2026-121810), the mail proxy (CVE-2026-113425), or `proxy_pass` with a variable plus an SSI/mirror subrequest (CVE-2026-123634) | alert naming the CVE, the feature and the mitigation (e.g. `http2 off`) until you upgrade and **restart** nginx — a reload does not replace the binary. Never bans |
| `nginx.worker-crash` | a run of nginx workers dying on memory faults (SIGSEGV and friends) | alert: that crash spray is what heap-grooming exploits leave behind |
| `web.worker-exec` | a web-server worker (nginx, Apache, php-fpm) executed a program | Critical alert: workers do not exec, so the process was hijacked — the RCE end state |
| `nginx.http2-spray` | a workload moved a lot of inbound bytes while logging few or no requests | review alert: the HTTP/2 heap spray's control frames are never logged, so its traffic looks like this (heuristic — a large upload can too; correlate with the two above) |
| `kernel.sctp-socket` | a web worker or container process created an SCTP socket | Critical/High alert: the first step of the kernel root-escalation |
| `kernel.sctp-exposed` | the Linux `sctp` module is loaded | alert: the unpatched kernel step of the chain is reachable; block it (`install sctp /bin/false`) on hosts that do not need SCTP |

Version exposure follows the two nginx tracks (odd minor = mainline, even =
stable), so 1.31.0 is still exposed though it sorts above 1.30.7. Source and
image builds are reported as exposed; distribution packages are only a lead,
because distros backport fixes without bumping the upstream number. Official
nginx images set `NGINX_VERSION`, which is read directly.
`STACKDOG_NGINX2ROOT_ENABLED=false` and `STACKDOG_KERNEL_SCTP_ENABLED=false`
turn the two checks off.

Honest limits: the exploit's HTTP/2 control frames are not logged as requests,
so Stackdog cannot see the attack traffic itself — it sees the exposure (version
and config), the crash spray, the network footprint, and the RCE aftermath.
`web.worker-exec` and `kernel.sctp-socket` read eBPF syscall events, which the
`serve` runtime does not collect yet. `nginx.http2-spray` is a workload-level
heuristic from Docker byte counters and log counts, not a per-connection
measurement. `vuln.nginx2root`, `nginx.worker-crash` and `kernel.sctp-exposed`
run from logs and the filesystem with no extra source.

---

## 📦 Installation
Expand Down
145 changes: 145 additions & 0 deletions docs/nginx2root-user-announcement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# Security update — NGINX2Root (CVE-2026-123007): update your trydirect/nginx image and install Stackdog

**Severity:** Critical (CVSS 9.2) · **Disclosed:** 18 Nov 2026 · **Action required**

> **TL;DR** — A critical, remotely exploitable nginx bug (CVE-2026-123007) is public.
> Update your `trydirect/nginx` image and **restart** your containers (a reload is
> not enough), then install Stackdog to keep watching for it and for other recent
> vulnerabilities such as PHP2Shell.

---

## What happened

On **18 November 2026**, five memory-corruption vulnerabilities in nginx — together
called **NGINX2Root** — were disclosed. The worst, **CVE-2026-123007**, is
**unauthenticated remote code execution over HTTP/2**: anyone who can reach a
server with HTTP/2 enabled can run commands as the nginx worker, with no
application bug required. A public proof-of-concept exists. A separate, still
**unpatched** Linux kernel bug can then escalate that access to **root**,
including escaping a Docker container onto the host.

This affects any nginx reachable directly from the internet — including static
sites. The fixed releases are **nginx 1.30.7 (stable)** and **1.31.9 (mainline)**
(NGINX Plus 37.0.8.1 / 37.3.0.1).

⚠️ **A configuration reload does _not_ fix this.** `nginx -s reload` keeps the old,
vulnerable binary answering. You must restart the process or re-create the
container.

We've released an updated **`trydirect/nginx`** image that carries the fix.

---

## 1 — Update your `trydirect/nginx` image

Pull the fixed image and **re-create** your containers (do not keep running the
old one):

```bash
# Pull the fixed image
docker pull trydirect/nginx:latest # or your pinned tag, e.g. trydirect/nginx:<new-version>

# docker compose
docker compose pull nginx
docker compose up -d --force-recreate nginx

# docker run
docker stop <nginx-container> && docker rm <nginx-container>
docker run -d ... trydirect/nginx:latest
```

Confirm the running build is fixed:

```bash
docker exec <nginx-container> nginx -v
# expect 1.30.7 / 1.31.9 or later (distro builds may show an older upstream
# number while still carrying the backported fix — check your package version)
```

**If you can't update right now**, turn the affected features off as a stopgap and
restart:

```nginx
http2 off; # CVE-2026-123007 / CVE-2026-123633 — or drop "http2" from listen
# remove quic/http3 listeners # CVE-2026-121810
# point proxy_pass at a fixed upstream # CVE-2026-123634 (no variables + SSI/mirror)
# restrict mail listeners to trusted IPs # CVE-2026-113425
```

On hosts that don't need SCTP, block the kernel escalation step too:

```bash
echo 'install sctp /bin/false' | sudo tee /etc/modprobe.d/zz-block-sctp.conf
sudo rmmod sctp 2>/dev/null || true
```

---

## 2 — Install Stackdog for ongoing protection

Stackdog is a lightweight security agent for Linux hosts and Docker containers —
real-time threat detection and response (a modern fail2ban, plus container and
host monitoring). One command to install:

```bash
curl -fsSL https://raw.githubusercontent.com/trydirect/stackdog/main/install.sh | sudo bash
```

Stackdog watches for **NGINX2Root** and other recent vulnerabilities:

| Threat | What Stackdog does |
|---|---|
| **NGINX2Root** (CVE-2026-123007 + 4 more) | Flags exposed nginx builds and the exact config that reaches each CVE (HTTP/2, HTTP/3, mail proxy, resolver) on the host and in containers; alerts on the worker-crash spray and on **any command run by an nginx worker** (the RCE tell); warns when the kernel SCTP escalation step is reachable. |
| **PHP2Shell** (CVE-2026-109618 / 109619) | Detects exposed PHP builds, PHP worker crashes, and the exploit footprint — and bans the clients driving it. |
| **SSHole** (CVE-2026-123158) | Flags vulnerable OpenSSH builds and bans password logins to key-only accounts. |
| **Everything else** (`vuln.cve-watch`) | Continuously matches every installed package on the host **and in containers** against OSV and CISA's known-exploited catalog. |

It also does fail2ban-style IP bans, container quarantine, file-integrity
monitoring, and webshell detection. It **detects and responds** — it does not
patch, so keep your images updated.

---

## How to tell if you were already hit

The attack is deliberately quiet (its HTTP/2 control frames are never logged), so
look for the aftermath:

- **Programs started by the nginx worker** — workers serve requests, they don't
run programs. Anything spawned by one is a strong sign of compromise:
```bash
ps -u www-data -o pid,ppid,lstart,cmd # or your nginx user
```
- **Runs of nginx workers dying on memory faults** (signal 11 / SIGSEGV):
```bash
sudo journalctl -u nginx --since "-24h" | grep -iE 'signal 11|segfault|worker process'
```
- **Loaded SCTP kernel module** (the root-escalation path):
```bash
grep sctp /proc/modules
```

If you see any of these, treat the host/container as compromised: isolate it,
rotate secrets, and investigate before bringing it back.

---

## Summary

1. **Update `trydirect/nginx`** and **restart / re-create** your containers — a
reload does not fix this.
2. **Install Stackdog** to continuously detect NGINX2Root, PHP2Shell, SSHole and
other vulnerabilities across your hosts and containers.
3. **Check the IOCs** above if you think you may have been exposed.

Questions? See the full write-up on the Stackdog blog
(**CVE-2026-123007: NGINX2Root and how to protect your servers and containers**)
or reach out to the trydirect team.

---

*Fill-in notes for the sender: confirm the exact `trydirect/nginx` tag to pull
(`:latest` vs a versioned tag) and the container/service names in the compose
examples to match how your users deploy it. The Stackdog install command and the
CVE facts are final.*
19 changes: 19 additions & 0 deletions ebpf/src/maps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub union EbpfEventData {
pub connect: ConnectData,
pub openat: OpenatData,
pub ptrace: PtraceData,
pub socket: SocketData,
pub raw: [u8; 264],
}

Expand Down Expand Up @@ -120,5 +121,23 @@ impl PtraceData {
}
}

#[repr(C)]
#[derive(Clone, Copy)]
pub struct SocketData {
pub domain: u32,
pub type_: u32,
pub protocol: u32,
}

impl SocketData {
pub const fn empty() -> Self {
Self {
domain: 0,
type_: 0,
protocol: 0,
}
}
}

#[map(name = "EVENTS")]
pub static EVENTS: RingBuf = RingBuf::with_byte_size(256 * 1024, 0);
21 changes: 20 additions & 1 deletion ebpf/src/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ use aya_ebpf::{
};

use crate::maps::{
ConnectData, EbpfEventData, EbpfSyscallEvent, ExecveData, OpenatData, PtraceData, EVENTS,
ConnectData, EbpfEventData, EbpfSyscallEvent, ExecveData, OpenatData, PtraceData, SocketData,
EVENTS,
};

const SYSCALL_ARG_START: usize = 16;
Expand All @@ -23,6 +24,7 @@ const SYS_EXECVE: u32 = 59;
const SYS_CONNECT: u32 = 42;
const SYS_OPENAT: u32 = 257;
const SYS_PTRACE: u32 = 101;
const SYS_SOCKET: u32 = 41;

const AF_INET: u16 = 2;
const AF_INET6: u16 = 10;
Expand Down Expand Up @@ -52,6 +54,12 @@ pub fn trace_ptrace(ctx: TracePointContext) -> i32 {
0
}

#[tracepoint(name = "sys_enter_socket", category = "syscalls")]
pub fn trace_socket(ctx: TracePointContext) -> i32 {
let _ = unsafe { try_trace_socket(&ctx) };
0
}

unsafe fn try_trace_execve(ctx: &TracePointContext) -> Result<(), i64> {
let filename_ptr = read_u64_arg(ctx, 0)? as *const u8;
let argv_ptr = read_u64_arg(ctx, 1)? as *const u64;
Expand Down Expand Up @@ -123,6 +131,17 @@ unsafe fn try_trace_ptrace(ctx: &TracePointContext) -> Result<(), i64> {
submit_event(&event)
}

unsafe fn try_trace_socket(ctx: &TracePointContext) -> Result<(), i64> {
let mut event = base_event(ctx, SYS_SOCKET);
let data = SocketData {
domain: read_u64_arg(ctx, 0)? as u32,
type_: read_u64_arg(ctx, 1)? as u32,
protocol: read_u64_arg(ctx, 2)? as u32,
};
event.data = EbpfEventData { socket: data };
submit_event(&event)
}

fn base_event(ctx: &TracePointContext, syscall_id: u32) -> EbpfSyscallEvent {
let mut event = EbpfSyscallEvent::empty();
event.pid = ctx.tgid();
Expand Down
Loading
Loading