mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-09 19:45:13 +02:00
[pitboss] phase 20: Track M.2 — MessageHandler end-to-end (Kafka / SQS / Pub-Sub / NATS / RabbitMQ)
This commit is contained in:
parent
fedc507e6a
commit
bd0135e423
45 changed files with 3227 additions and 25 deletions
|
|
@ -0,0 +1,9 @@
|
|||
"""Phase 20 (Track M.2) — Kafka Python benign control."""
|
||||
import os
|
||||
import shlex
|
||||
|
||||
_NYX_ADAPTER_MARKER = "from kafka import KafkaConsumer"
|
||||
|
||||
|
||||
def handler(message):
|
||||
os.system("echo " + shlex.quote(str(message)))
|
||||
25
tests/dynamic_fixtures/message_handler/kafka_python/vuln.py
Normal file
25
tests/dynamic_fixtures/message_handler/kafka_python/vuln.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
"""Phase 20 (Track M.2) — Kafka Python vuln fixture.
|
||||
|
||||
`handler` is a Kafka consumer callback (modelled after
|
||||
`KafkaConsumer('orders').poll()` dispatch) that splices the raw
|
||||
message body into a shell command via `os.system`. A malicious
|
||||
producer can inject command-separator metacharacters into the body
|
||||
and the shell will execute them — the classic message-handler cmdi
|
||||
shape.
|
||||
|
||||
Adapter source-marker: `from kafka import KafkaConsumer` is kept as a
|
||||
docstring reference (not a top-level import) so the harness can run
|
||||
without the real `kafka-python` library installed on the host.
|
||||
"""
|
||||
import os
|
||||
|
||||
# Phase 20 framework adapter detects this fixture via the `from kafka`
|
||||
# / `import kafka` substring scan. Keeping the marker in source lets
|
||||
# the adapter bind without forcing the host to pin the kafka-python
|
||||
# pip dep just to load the fixture module.
|
||||
_NYX_ADAPTER_MARKER = "from kafka import KafkaConsumer"
|
||||
|
||||
|
||||
def handler(message):
|
||||
# SINK: tainted message body concatenated into shell command
|
||||
os.system("echo " + str(message))
|
||||
Loading…
Add table
Add a link
Reference in a new issue