Files
mtusi2026lab7/evidence/lab7/track1/summary.md
T

13 KiB
Raw Blame History

Lab 7 — Grade 5, Track 1 («Компрометация worker») — Сводка эксперимента

  • Дата прогона (UTC): 2026-11-26T16:05:17Z
  • Общий результат: PASS (48/48 проверок)
  • Zero Image Rebuild: api sha256:f51ee28c0937 == sha256:f51ee28c0937, worker sha256:f51ee28c0937 == sha256:f51ee28c0937
  • Ротация идентичности worker: messenger-worker-g2 (serial 1018) → messenger-worker-g3 (serial 1019)

1. Гипотеза

Under Lab 7 least-privilege boundaries (OpenBao auth/cert + worker-policy, PostgreSQL messenger_worker table/column grants, tightened MinIO prefix policy, RabbitMQ EXTERNAL consumer-only ACL, zero Redis access in worker, and API mTLS LB-SAN allowlist), full compromise of the worker container yields zero access to user credentials, sessions, private messages, chats, or API/admin secrets, and cannot forge jobs, delete committed originals, or alter attachment integrity metadata; revoking the compromised worker identity and rotating all related credentials without rebuilding images immediately blocks all stolen access on new connections while preserving 100% of queued and in-flight jobs with zero duplicates.

2. Сравнение последствий: До (Lab 6) vs После (Lab 7 Least Privilege)

Контур До (Lab 6 baseline) После (Lab 7 hardened) Снижение blast radius
PostgreSQL Shared messenger superuser/table-owner via .env DATABASE_URL over plaintext TCP; compromised worker could read users.password_hash, all messages/chats, or DROP tables. Dedicated messenger_worker role over TLS verify-full with strictly 5 pipeline tables + column-level UPDATE; users, chats, chat_members, messages, message_attachments, idempotency_keys, schema_migrations, DELETE attachments/jobs, UPDATE sha256, and DDL all fail with 42501. 100% elimination of user credential, message, chat, and schema exposure from worker.
MinIO S3 Plaintext HTTP; static keys in ./secrets/; broad s3:PutObject across attachments/*. HTTPS + CA verify; rotatable IAM user in OpenBao; staging/* Get/Delete only (no Put); attachments//original Get/Put only (no Delete); attachments//v*/* Put/Delete; backups/, admin/, bucket root list, CreateBucket, and MinIO Admin API all fail with 403 AccessDenied. Eliminates staging poisoning, committed original deletion, and cross-prefix/admin pivoting.
RabbitMQ Plaintext AMQP 5672; static password file; configure/write/read across topology (worker could forge jobs and tamper with queues). AMQPS 5671 + mTLS SASL EXTERNAL (generation-suffixed CN); configure=^, write=^, read=^attachments.process$; OutboxRelay removed from worker. Publish to attachments.jobs, declare/delete queue, DLQ consume, and vhost / all fail with 403 ACCESS_REFUSED. Eliminates job forgery, topology tampering, DLQ reading, and vhost pivoting.
Redis Plaintext TCP, unauthenticated REDIS_URL in worker .env; raw Bearer tokens stored in session:. TLS + mTLS + user default off + ACLs; RedisModule removed from WorkerModule (zero Redis credentials in worker); API stores only session:sha256:. 100% elimination of user session hijacking and rate-limit tampering from worker.
Secrets / OpenBao No KMS; all secrets in .env / ./secrets/ including POSTGRES_PASSWORD and METRICS_TOKEN. Non-dev Raft OpenBao over TLS; mTLS auth/cert + worker-policy (token_no_default_policy=true) + CRL; zero API/migrator/operator/root secrets reachable; sub-second accessor + CRL revocation. Eliminates static secret sprawl and enables live zero-rebuild revocation/rotation.
API Internal Surface Plaintext http://api:8080 reachable directly from worker container. Mandatory mTLS + LB SAN allowlist (haproxy-lb) + CRL on api:8443; valid CA-signed worker cert rejected with 403. Eliminates direct LB bypass and API impersonation from worker.

3. Проверка отзыва украденных credentials (g1) на новых соединениях (NC-6)

Граница Результат после scripts/revoke-worker.sh Деталь
openbao_token REJECTED (PASS) 403
openbao_cert REJECTED (PASS) 400
postgres REJECTED (PASS) 28P01
minio_s3 REJECTED (PASS) InvalidAccessKeyId
rabbitmq REJECTED (PASS) Handshake terminated by server: 403 (ACCESS-REFUSED) with message "ACCESS_REFUSED - Login was refused using authentication mechanism EXTERNAL. For details see the broker logfile."
otel_gateway REJECTED (PASS) ERR_SSL_SSL/TLS_ALERT_CERTIFICATE_REVOKED

4. Сохранность и обработка заданий (Pre / During / Post Containment)

Этап Attachment ID Status Original SHA-256 Variants (0 dups) Thumbnail 256×160
pre_compromise 9678e967-d8a3-4b1e-afb0-ccd4de92ecef ready True 3/3 (True) True ([256, 160])
pre_revocation 03fac44e-dccf-47b5-ac0d-758b98168ea2 ready True 3/3 (True) True ([256, 160])
during_containment_1 5eae2cc8-2ef4-498d-a0a2-fe18358746f3 ready True 3/3 (True) True ([256, 160])
during_containment_2 398e91cc-43b3-496c-9e79-d82dda372464 ready True 3/3 (True) True ([256, 160])
post_recovery eb231d77-d5ed-4160-b5a4-7c92010289ff ready True 3/3 (True) True ([256, 160])

5. Детальные результаты всех проверок

ID Категория Статус Фактический результат
T1-00-WORKER-ENV-CLEAN baseline PASS leaked_vars=[]
T1-01-BASELINE-UPLOAD-READY baseline PASS att_pre=9678e967-d8a3-4b1e-afb0-ccd4de92ecef status=ready
T1-BAO-01-ALLOW-OWN blast_openbao PASS login=200 own=200 cn=messenger-worker-g2 san=DNS:messenger-worker
T1-BAO-02-DENY-API blast_openbao PASS status=403
T1-BAO-03-DENY-MIGRATOR blast_openbao PASS status=403
T1-BAO-04-DENY-OPERATOR blast_openbao PASS status=403
T1-BAO-05-DENY-POLICY-WRITE blast_openbao PASS status=403
T1-BAO-06-DENY-API-ROLE-LOGIN blast_openbao PASS status=400
T1-PG-07-ALLOW-PIPELINE blast_postgres PASS {'allow_select_jobs': True, 'allow_select_attachments': True, 'allow_select_variants': True, 'allow_update_att_status_noop': True}
T1-PG-08-DENY-USERS blast_postgres PASS allowed=False code=42501
T1-PG-09-DENY-MESSAGES blast_postgres PASS allowed=False code=42501
T1-PG-10-DENY-CHATS blast_postgres PASS allowed=False code=42501
T1-PG-11-DENY-CHAT-MEMBERS blast_postgres PASS allowed=False code=42501
T1-PG-12-DENY-MSG-ATT blast_postgres PASS allowed=False code=42501
T1-PG-13-DENY-IDEMPOTENCY blast_postgres PASS allowed=False code=42501
T1-PG-14-DENY-MIGRATIONS blast_postgres PASS allowed=False code=42501
T1-PG-15-DENY-DELETE-ATT blast_postgres PASS allowed=False code=42501
T1-PG-16-DENY-DELETE-JOBS blast_postgres PASS allowed=False code=42501
T1-PG-17-DENY-UPDATE-SHA256 blast_postgres PASS allowed=False code=42501
T1-PG-18-DENY-DDL-CREATE blast_postgres PASS allowed=False code=42501
T1-S3-19-ALLOW-OWN-PREFIX blast_s3 PASS {'allow_get_staging': 200, 'allow_del_staging': 204, 'allow_get_original': 200, 'allow_put_variant': 200, 'allow_del_variant': 204}
T1-S3-20-DENY-GET-BACKUPS blast_s3 PASS allowed=False status=403 code=AccessDenied
T1-S3-21-DENY-PUT-BACKUPS blast_s3 PASS allowed=False status=403 code=AccessDenied
T1-S3-22-DENY-PUT-ADMIN blast_s3 PASS allowed=False status=403 code=AccessDenied
T1-S3-23-DENY-PUT-STAGING blast_s3 PASS allowed=False status=403 code=AccessDenied
T1-S3-24-DENY-DEL-ORIGINAL blast_s3 PASS allowed=False status=403 code=AccessDenied
T1-S3-25-DENY-LIST-ROOT blast_s3 PASS allowed=False status=403 code=AccessDenied
T1-S3-26-DENY-CREATE-BUCKET blast_s3 PASS allowed=False status=403 code=AccessDenied
T1-S3-27-DENY-MINIO-ADMIN blast_s3 PASS allowed=False status=403 code=AccessDenied
T1-RMQ-28-ALLOW-CONSUME blast_rabbitmq PASS {'allowed': True, 'detail': 'consumed_ok'}
T1-RMQ-29-DENY-PUBLISH-JOBS blast_rabbitmq PASS allowed=False error=channel closed
T1-RMQ-30-DENY-DECLARE-QUEUE blast_rabbitmq PASS allowed=False error=Operation failed: QueueDeclare; 403 (ACCESS-REFUSED) with message "ACCESS_REFUSED - configure access to queue 'track1.pwned.queue' in vhost 'messenger' refused for user 'messenger-worker-g2'"
T1-RMQ-31-DENY-DELETE-QUEUE blast_rabbitmq PASS allowed=False error=Operation failed: QueueDelete; 403 (ACCESS-REFUSED) with message "ACCESS_REFUSED - configure access to queue 'attachments.process' in vhost 'messenger' refused for user 'messenger-worker-g2'"
T1-RMQ-32-DENY-CONSUME-DLQ blast_rabbitmq PASS allowed=False error=Operation failed: BasicConsume; 403 (ACCESS-REFUSED) with message "ACCESS_REFUSED - read access to queue 'attachments.process.dlq' in vhost 'messenger' refused for user 'messenger-worker-g2'"
T1-RMQ-33-DENY-ROOT-VHOST blast_rabbitmq PASS allowed=False error=Expected ConnectionOpenOk; got <ConnectionClose channel:0>
T1-LAT-34-DENY-REDIS blast_lateral PASS allowed=False error=NOAUTH HELLO must be called with the client already authenticated, otherwise the HELLO <proto> AUTH <user> <pass> option can be used to authenticate the client and select the RESP protocol version at the same time
T1-LAT-35-DENY-API-MTLS blast_lateral PASS status=403 error=None
T1-CONTAIN-36-API-202-WHILE-WORKER-STOPPED containment PASS ids=['03fac44e-dccf-47b5-ac0d-758b98168ea2', '5eae2cc8-2ef4-498d-a0a2-fe18358746f3', '398e91cc-43b3-496c-9e79-d82dda372464']
T1-REVOKE-37-IDENTITY-ROTATED revocation PASS messenger-worker-g2(1018) -> messenger-worker-g3(1019)
T1-REVOKED-38-OPENBAO_TOKEN revocation_nc6 PASS {"rejected": true, "status": 403}
T1-REVOKED-39-OPENBAO_CERT revocation_nc6 PASS {"rejected": true, "status": 400}
T1-REVOKED-40-POSTGRES revocation_nc6 PASS {"rejected": true, "code": "28P01", "error": "password authentication failed for user \"messenger_worker\""}
T1-REVOKED-41-MINIO_S3 revocation_nc6 PASS {"rejected": true, "status": 403, "code": "InvalidAccessKeyId"}
T1-REVOKED-42-RABBITMQ revocation_nc6 PASS {"rejected": true, "error": "Handshake terminated by server: 403 (ACCESS-REFUSED) with message \"ACCESS_REFUSED - Login was refused using authentication mechanism EXTERNAL. For details see the broker logfile.\""}
T1-REVOKED-43-OTEL_GATEWAY revocation_nc6 PASS {"rejected": true, "status": null, "error": "ERR_SSL_SSL/TLS_ALERT_CERTIFICATE_REVOKED"}
T1-RECOVER-44-ZERO-IMAGE-REBUILD recovery PASS api_same=True, worker_same=True
T1-RECOVER-45-ALL-JOBS-DURABLE durability PASS {'pre_compromise': {'status': 'ready', 'sha_ok': True, 'no_dups': True, 'thumb_ok': True}, 'pre_revocation': {'status': 'ready', 'sha_ok': True, 'no_dups': True, 'thumb_ok': True}, 'during_containment_1': {'status': 'ready', 'sha_ok': True, 'no_dups': True, 'thumb_ok': True}, 'during_containment_2': {'status': 'ready', 'sha_ok': True, 'no_dups': True, 'thumb_ok': True}, 'post_recovery': {'status': 'ready', 'sha_ok': True, 'no_dups': True, 'thumb_ok': True}}
T1-RECOVER-46-CANARY-INTACT durability PASS canary_intact=True, eve_blocked=True

6. Остаточные риски и ограничения

  1. In-scope functional abuse before detection: until revoked, a compromised worker legitimately needs read access to staging/* and write access to attachments//v/* and attachments/*/original for claimed jobs, so it could delay or corrupt rendered variants of active jobs (mitigated by immutable attachments.sha256, job timeouts, and queue lag alerts).
  2. Single-host lab boundary: host OS root or Docker daemon compromise is outside container isolation; production deployments isolate nodes, run multi-node OpenBao Raft HA with KMS auto-unseal, and issue short-lived workload certs via SPIRE/OpenBao PKI.
  3. Active connection drain window: credential revocation immediately blocks all new connections (TLS session resumption disabled); active sockets are terminated explicitly during scripts/revoke-worker.sh via pg_terminate_backend, rabbitmqctl delete_user, MinIO user deletion, and OpenBao accessor revocation.