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

オープン 初心者向け
#350 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
javascript, node.js

調査の方向性

まず templates/node/github-issue-bot/src/github.js を読み、提供されている node poc.js の再現を実行して、ヘッダーがない場合の動作を確認します。X-Hub-Signature-256 のないリクエストが拒否され、設定された webhook secret による暗号学的検証の後にのみリクエストが受け入れられれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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?
主要言語
HTML
スター
174
フォーク
129
平均マージ
1日 15時間
マージ済み PR(30日)
11

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

appwrite/templates のほかの issue

appwrite/templates の issue をすべて見る

似ている issue

Security の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。