Authentication Bypass in GitHub Webhook Verification via Missing X-Hub-Signature-256 Header

Abierto Apto para principiantes
#350 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
javascript, node.js

Línea de trabajo

Empieza leyendo templates/node/github-issue-bot/src/github.js y ejecuta la reproducción proporcionada node poc.js para confirmar el comportamiento cuando falta el header. Se considera terminado cuando las solicitudes sin X-Hub-Signature-256 son rechazadas y las solicitudes solo se aceptan después de la verificación criptográfica con el secreto de webhook configurado.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Reproduction steps

Reproduction steps*
Clone the Appwrite templates repository:
git clone https://github.com/appwrite/templates.git
Navigate to the vulnerable template:
cd templates/node/github-issue-bot
Verify the vulnerable code exists:
grep -n "typeof signature" src/github.js

Output:

19: typeof signature !== 'string' ||
Inspect the vulnerable function:
sed -n '1,80p' src/github.js
Create a PoC file:
cat > poc.js << 'EOF'
async function verifyWebhook(req) {
const signature = req.headers['x-hub-signature-256'];

return (
typeof signature !== 'string' ||
true
);
}

(async () => {
const req = {
headers: {}
};

const result = await verifyWebhook(req);

console.log("[] Missing signature header");
console.log("[
] verifyWebhook() returned:", result);

if (result === true) {
console.log("[+] Vulnerability confirmed");
} else {
console.log("[-] Not vulnerable");
}
})();
EOF
Execute the PoC:
node poc.js
Observe the output:
[] Missing signature header
[
] verifyWebhook() returned: true
[+] Vulnerability confirmed
Additional verification:
node -e "const signature=undefined; console.log(typeof signature !== 'string' || false)"

Output:

true

This confirms that requests without the X-Hub-Signature-256 header are incorrectly treated as authenticated.

Expected behavior

Requests missing the X-Hub-Signature-256 webhook signature header should be rejected.

verifyWebhook() should return false unless the webhook signature is cryptographically verified using the configured webhook secret.

Actual Behavior

Requests without the X-Hub-Signature-256 header are treated as valid because of incorrect boolean logic:

typeof signature !== 'string' || verify(...)

When the header is missing, the first condition evaluates to true, causing the function to bypass signature verification entirely.

As a result, forged webhook requests may be accepted if the application relies on this function for authentication.

Appwrite version

Appwrite Cloud

Operating system

Linux

Your Environment

OS: Kali Linux
Runtime: Node.js
Repository: appwrite/templates
Component: node/github-issue-bot
File: src/github.js

Have you spent some time to check if this issue has been raised before?
  • I checked and didn't find similar issue
Have you read the Code of Conduct?
Lenguaje dominante
HTML
Estrellas
174
Forks
129
Merge medio
1 d 15 h
PR fusionados (30 d)
11

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de appwrite/templates

Todos los issues de appwrite/templates

Issues similares

Más issues de Security

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.