Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2024-6387 PoC — Openssh: regresshion - race condition in ssh allows rce/dos

Source
Associated Vulnerability
Title:Openssh: regresshion - race condition in ssh allows rce/dos (CVE-2024-6387)
Description:A security regression (CVE-2006-5051) was discovered in OpenSSH's server (sshd). There is a race condition which can lead sshd to handle some signals in an unsafe manner. An unauthenticated, remote attacker may be able to trigger it by failing to authenticate within a set time period.
Description
An Ansible Playbook to mitigate the risk of RCE (CVE-2024-6387) until platforms update OpenSSH to a non-vulnerable version.
Readme
# CVE-2024-6387 Mitigation Ansible Playbook

An Ansible Playbook to mitigate the risk of the regreSSHion RCE (CVE-2024-6387) vulnerability until platforms update OpenSSH to a non-vulnerable version.

The mitigation applied here is based on the [Mitigation Advice provided by Red Hat](https://access.redhat.com/security/cve/cve-2024-6387).
As noted there:

> Notice the sshd server will still be vulnerable to Denial of Service attacks due to there
> possibility os MaxStartups connection exhaustion, however it'll be safe against possible remote code execution attacks.

You should keep this in mind before applying the mitigation.

# Pre-requisites

- Ansible
- Linux server with OpenSSH Server installed

# Assumptions

- You have a drop-in configuration directory at: `/etc/ssh/sshd_config.d/`
- You are affected by CVE-2024-6387 - see affected package versions [here](https://www.qualys.com/regresshion-cve-2024-6387/).
- `ansible` user set up on target server(s) with sufficient permissions to write in `/etc/ssh/sshd_config.d/`.
  Here, `sudo` permissions are assumed for best compatibility (though this is not necessarily the best approach).

The playbook also includes an alternative step (to replace the drop-in one) which
could be used to apply this patch in-place i.e. in the `/etc/ssh/sshd_config` file itself.

# Usage

```
ansible-playbook ./apply_mitigation.yaml --limit <your host group>
```

# Disclaimer

This Ansible playbook is provided AS IS WITHOUT WARRANTY and WITHOUT ANY LIABILITY.
If you break your SSHd configuration, servers or anything else, I take no responsibility.

Just sharing this to help others.
File Snapshot

[4.0K] /data/pocs/f6a4ac72f86020372a58e0c23955bad1ac5f861f ├── [1.2K] apply_mitigation.yaml ├── [ 34K] LICENSE └── [1.6K] README.md 0 directories, 3 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →