This commit is contained in:
Eli Peter 2026-06-05 10:16:30 -05:00 committed by GitHub
parent 55247b7fcd
commit 991c84a1eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
1464 changed files with 225448 additions and 1985 deletions

View file

@ -0,0 +1,21 @@
"""Phase 20 (Track M.2) — Google Pub/Sub Python benign control."""
import os
import shlex
_NYX_ADAPTER_MARKER = "from google.cloud import pubsub_v1"
_NYX_TOPIC_MARKER = '.subscribe("projects/p/subscriptions/s"'
def callback(message):
body = getattr(message, 'data', None)
if body is None and isinstance(message, dict):
body = message.get('data')
if isinstance(body, (bytes, bytearray)):
body = body.decode('utf-8', 'replace')
if body is None:
body = str(message)
os.system("echo " + shlex.quote(body))
try:
message.ack()
except Exception:
pass

View file

@ -0,0 +1,28 @@
"""Phase 20 (Track M.2) — Google Pub/Sub Python vuln fixture.
`callback` is a `pubsub_v1.SubscriberClient.subscribe` callback that
takes `message.data` bytes straight into a shell command.
Adapter marker kept as a string literal so the google-cloud-pubsub dep
is not required to load the module.
"""
import os
_NYX_ADAPTER_MARKER = "from google.cloud import pubsub_v1"
_NYX_TOPIC_MARKER = '.subscribe("projects/p/subscriptions/s"'
def callback(message):
body = getattr(message, 'data', None)
if body is None and isinstance(message, dict):
body = message.get('data')
if isinstance(body, (bytes, bytearray)):
body = body.decode('utf-8', 'replace')
if body is None:
body = str(message)
# SINK: tainted message body concatenated into shell command
os.system("echo " + body)
try:
message.ack()
except Exception:
pass