Share
## https://sploitus.com/exploit?id=AC7DE1B5-8791-5B21-90B5-F6A35A78ABC3
# CVE-2026-31431 (Copy Fail) Checker
Verifica si un host Linux es vulnerable a CVE-2026-31431 y aplica mitigación.
## Archivos
- `check_cve_2026_31431.yml` - Playbook de Ansible para verificar y parchear
- `revert_cve_2026_31431.yml` - Playbook de Ansible para deshacer mitigación
- `run_check.sh` - Script para ejecutar verificación local o remotamente
- `run_revert.sh` - Script para deshacer cambios local o remotamente
## Ejemplos de ejecución
### 1. Verificar vulnerabilidad (run_check.sh)
```bash
./run_check.sh
# Seleccionar 'l' para local
```
O directamente:
```bash
ansible-playbook -i "localhost," -c local --ask-become-pass check_cve_2026_31431.yml -v
```
### 2. Revertir cambios (run_revert.sh)
Deshace la mitigación aplicada por run_check.sh:
```bash
./run_revert.sh
# Seleccionar 'l' para local
```
O directamente:
```bash
ansible-playbook -i "localhost," -c local --ask-become-pass revert_cve_2026_31431.yml -v
```
El revert elimina `/etc/modprobe.d/disable-algif.conf` e intenta recargar el módulo `algif_aead`.
### 2. Remoto
```bash
ansible-playbook -i "192.168.1.100," -u ubuntu --ask-become-pass check_cve_2026_31431.yml -v
```
Con múltiples hosts (crear `hosts.ini`):
```ini
[servers]
192.168.1.100
192.168.1.101
```
```bash
ansible-playbook -i hosts.ini --ask-become-pass check_cve_2026_31431.yml -v
```
### 3. Revertir cambios (deshacer mitigación)
```bash
./run_revert.sh
# Seleccionar 'l' para local
```
### 4. Dentro de un Docker container
```bash
docker run -it --privileged ubuntu:22.04 /bin/bash
# Dentro del container:
apt update && apt install -y ansible python3
# Copiar el playbook al container o usar curl/wget
ansible-playbook -i "localhost," -c local check_cve_2026_31431.yml -v
```
O montando el playbook desde el host:
```bash
docker run -it --privileged -v $(pwd)/check_cve_2026_31431.yml:/check.yml ubuntu:22.04
# Dentro: ansible-playbook -i "localhost," -c local /check.yml -v
```
### 5. CI/CD Pipeline para imágenes Docker
**GitHub Actions** (`.github/workflows/check-cve.yml`):
```yaml
name: Check CVE-2026-31431
on:
push:
branches: [ main ]
pull_request:
jobs:
check-vulnerability:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build test image
run: docker build -t test-image .
- name: Check for CVE-2026-31431 in container
run: |
docker run --rm \
-v ${{ github.workspace }}/check_cve_2026_31431.yml:/check.yml \
test-image \
/bin/bash -c "apt update && apt install -y ansible python3 && \
echo 'no' | ansible-playbook -i 'localhost,' -c local /check.yml -v"
- name: Fail if vulnerable
run: |
# El playbook debe retornar != 0 si es vulnerable
# O parsear la salida buscando "VULNERABLE"
```
**GitLab CI** (`.gitlab-ci.yml`):
```yaml
stages:
- build
- security
build_image:
stage: build
script:
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
check_cve:
stage: security
script:
- docker run --rm -v $(pwd)/check_cve_2026_31431.yml:/check.yml $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
/bin/bash -c "apt-get update && apt-get install -y ansible python3 &&
ansible-playbook -i 'localhost,' -c local /check.yml -v | grep -q 'SAFE' || exit 1"
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
```
**Dockerfile con verificación en build**:
```dockerfile
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y ansible python3 wget
# Copiar y ejecutar check durante build
COPY check_cve_2026_31431.yml /tmp/
RUN echo "no" | ansible-playbook -i "localhost," -c local /tmp/check_cve_2026_31431.yml -v | \
grep -q "SAFE" || (echo "VULNERABLE - Fix before building" && exit 1)
# Resto de tu imagen...
```
## Qué hace run_check.sh
1. Verifica si el algoritmo `authencesn` es accesible vía AF_ALG
2. Si es vulnerable, pregunta si aplicar mitigación:
- Deshabilita módulo `algif_aead` (crea `/etc/modprobe.d/disable-algif.conf`)
- Actualiza kernel si está disponible
3. Re-verifica después del parche
## Qué hace run_revert.sh
1. Elimina `/etc/modprobe.d/disable-algif.conf`
2. Intenta recargar el módulo `algif_aead`
3. Verifica si el sistema vuelve a estar vulnerable
## Qué hace el playbook
1. Verifica si el algoritmo `authencesn` es accesible vía AF_ALG
2. Si es vulnerable, pregunta si aplicar mitigación:
- Deshabilita módulo `algif_aead`
- Actualiza kernel si está disponible
3. Re-verifica después del parche
## Resultado esperado
```
Status: SAFE - System is protected
```
© 2026 EximiaIT
Security Assessment Tool – CVE-2026-31431 (Copy Fail)
This project is intended for authorized security testing, auditing, and educational purposes only.
Any use of this software without proper authorization is strictly prohibited.
EximiaIT assumes no liability for misuse or damages resulting from this tool.