sshole

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2026 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Overview

Package sshole is the detector for *sshole, the OpenSSH password authentication bypass on musl libc fixed in OpenSSH 10.6p2 (commit 4353fdc43, 2026-11-05) and in Alpine's openssh packages the same day. On musl, sshd before the fix compares an account's password field of "*" with the "*" that musl's crypt returns when it fails, so a password that makes crypt fail logs in to that account.

It finds OpenSSH servers in filesystems and container images, judges each by its C library, its release and the apk database, and then checks what the target's sshd_config and account files make reachable. It also checks live servers (what a banner and the offered methods can tell) and the Dockerfiles and scripts in a source tree.

internal/assess knows nothing about the engine; this file adapts it.

Index

Constants

View Source
const (
	KindAPKPin     = repo.RulePin
	KindAPKFloor   = repo.RuleUnpinned
	KindEOL        = repo.RuleEOL
	KindStar       = repo.RuleStar
	KindPassword   = repo.RulePassword
	KindNotChecked = repo.RuleNotChecked
)

Kind IDs for a source tree.

View Source
const (
	KindExposed = assess.KindExposed
	KindServer  = assess.KindServer
	KindHost    = "host"
)

Kind IDs.

View Source
const ID = "sshole"

ID is the detector's ID.

View Source
const KindImage = "image"

KindImage: an image the source tree builds on or deploys holds an OpenSSH server exposed to *sshole.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detector

type Detector struct{}

Detector implements engine.Detector, engine.Reader, engine.Prober, engine.RepoScanner and engine.Fixer.

func (*Detector) Fix

func (d *Detector) Fix(ctx context.Context, dirs []string, o engine.Options, stdout, stderr io.Writer) int

Fix rewrites what can be fixed: apk constraints to the fixed release and "*" password fields to "*NP*". Each edit is rescanned in memory first.

func (*Detector) Load

func (d *Detector) Load() error

Load has nothing to load: the knowledge is in the code.

func (*Detector) Manifest

func (d *Detector) Manifest() engine.Manifest

Manifest describes the detector.

func (*Detector) NewScan

func (d *Detector) NewScan(kind engine.TargetKind) engine.Scan

NewScan starts a filesystem or image scan.

func (*Detector) Probe

func (d *Detector) Probe(ctx context.Context, addr string, timeout time.Duration) (string, int, []engine.Finding, error)

Probe connects to an SSH server (default port 22), reads its banner and asks which authentication methods it offers. It sends no password: when the server offers password logins, the client stops there.

func (*Detector) ScanRepo

func (d *Detector) ScanRepo(ctx context.Context, dir string, o engine.Options) *engine.Target

ScanRepo checks a source tree.

func (*Detector) Wants

func (d *Detector) Wants(p string, head []byte, _ bool) bool

Wants reads executables (possible sshd binaries) and the few files the verdict depends on.

Directories

Path Synopsis
internal
assess
Package assess decides whether an OpenSSH server is exposed to *sshole: on musl libc, sshd before 10.6p2 compares a password field of "*" with crypt's failure result "*", so a password that makes crypt fail logs in.
Package assess decides whether an OpenSSH server is exposed to *sshole: on musl libc, sshd before 10.6p2 compares a password field of "*" with crypt's failure result "*", so a password that makes crypt fail logs in.
repo
Package repo finds what in a source tree builds or configures an OpenSSH server exposed to *sshole, and plans the edits that fix it:
Package repo finds what in a source tree builds or configures an OpenSSH server exposed to *sshole, and plans the edits that fix it:
testelf
Package testelf builds the small ELF executables the sshole tests read.
Package testelf builds the small ELF executables the sshole tests read.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL