NewsCrawler.org

AWS DevOps Agent investigates a planted vulnerability and files a GitHub Issue

AWS DevOps Agent に障害を調査させたら、仕込んだ脆弱性を特定してくれた話
AWS システム構成図
システムフロー図
Image: zenn.dev

The author built a web app with a deliberately planted vulnerability and wired everything so that an attack automatically creates a GitHub Issue with no human involvement. AWS DevOps Agent is an autonomous AI agent for cloud operations that helps resolve and prevent incidents and optimize applications; its scope is set in an AgentSpace[1], which links the AWS accounts to investigate and the sources of events, and where the progress and results of each investigation are recorded. In this setup, investigation results go to EventBridge, which invokes a Lambda that writes them into a GitHub Issue; an investigation starts when CloudWatch detects HTTP 5XX status codes and a CloudWatch Alarm switches from OK to ALARM.

The author skipped Amazon Inspector and bandit[2] in favor of detecting incidents as they happen: standing scanners would make the agent unnecessary, scan timing cannot be controlled during debugging, and Inspector is enabled per account, so other Lambda functions in the same account would also be subject to scanning and billing. The planted flaw is a user search API that embeds user input into a PartiQL[3] query via string concatenation — the same structure as an SQL injection[4]. Input like ' OR 'a'='a returned all registered usernames with status 200 and created no Issue, while a single quote caused a syntax error with status 500 and did create one. The agent received no hints about the planted vulnerability, only CloudWatch error logs as input, and with read access to the GitHub sources it produced a detailed Issue.

The Issue proposes replacing concatenation with a placeholder ? plus Parameters binding, adding input validation that answers unexpected input with a 400 or a safe empty result, and redeploying; it also notes the running code exists nowhere in git, so a rollback must be based on the saved deployment artifact rather than a git revert. Pitfalls included an API Gateway stage that kept pointing at an old Deployment — cdk deploy fixed nothing because CloudFormation saw no diff, and the fix was to redeploy the stage manually — plus four CloudFront behavior settings that had to be set explicitly for the /api/* path: allowed_methods, cache_policy, origin_request_policy and function_associations, without which POST requests got 403, responses were cached so attacks kept returning the same result, the query string never reached the origin, and IP restriction did not apply to the API. The author wanted to go as far as creating a fix branch and a pull request from the Issue but left that for another time.

Read the original zenn.dev

Sources

  • Zenn JA

    AWS DevOps Agent に障害を調査させたら、仕込んだ脆弱性を特定してくれた話

    9 likes2 bookmarks0 comments

Published: First seen: Читать по-русски

Open as a page