Skip to content

fix(security): add Twilio webhook signature validation (SMS RCE fix)#7933

Merged
teknium1 merged 7 commits into
mainfrom
hermes/hermes-c78b9811
Apr 11, 2026
Merged

fix(security): add Twilio webhook signature validation (SMS RCE fix)#7933
teknium1 merged 7 commits into
mainfrom
hermes/hermes-c78b9811

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Adds HMAC-SHA1 signature validation for inbound Twilio webhooks in the SMS adapter. Without this, anyone who can reach the webhook port can inject forged SMS messages that the agent processes with full tool access — unauthenticated RCE.

Salvaged from PR #7904 by @entropidelic (Mariano Nicolini). Cherry-picked all 6 contributor commits with authorship preserved.

Fixes #7089

What changed

  • gateway/platforms/sms.py — Twilio X-Twilio-Signature HMAC-SHA1 validation, fail-closed startup guard (SMS_WEBHOOK_URL required), insecure dev opt-out (SMS_INSECURE_NO_SIGNATURE), configurable bind host (SMS_WEBHOOK_HOST), port variant handling (443/80 toggle), keep_blank_values=True fix for parse_qs
  • tests/gateway/test_sms.py — 22 new tests across 4 test classes (config, startup guard, signature validation unit, webhook enforcement integration). Follow-up: mocked aiohttp server in startup guard tests to avoid port-binding flakiness.
  • website/docs/ — Updated SMS guide and environment variables reference

Test results

  • 44/44 SMS tests pass
  • 107/107 api_server tests pass (refactor check)
  • 2517/2517 gateway tests pass (26 pre-existing failures in unrelated files)

Closes duplicates

This also closes these duplicate PRs for the same vulnerability:

Credit to all contributors for identifying and reporting this issue.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Supply Chain Risk Detected

This PR contains patterns commonly associated with supply chain attacks. This does not mean the PR is malicious — but these patterns require careful human review before merging.

⚠️ WARNING: base64 encoding/decoding detected

Base64 has legitimate uses (images, JWT, etc.) but is also commonly used to obfuscate malicious payloads. Verify the usage is appropriate.

Matches (first 20):

1339:+        computed = base64.b64encode(mac.digest()).decode("utf-8")
3292:+    return base64.b64encode(mac.digest()).decode("utf-8")

⚠️ WARNING: Install hook files modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/memory_setup.py
hermes_cli/setup.py

Automated scan triggered by supply-chain-audit. If this is a false positive, a maintainer can approve after manual review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Unauthenticated Remote Code Execution via SMS Webhook — Missing Twilio Signature Validation

2 participants