360 Secure SkillHub
360 安全技能中心

alibabacloud-ecs-security-audit-and-intrusion-response

面向阿里云 ECS 的安全审计与入侵响应技能,按客户症状把问题路由到六个处理轴:暴力破解防护、AK 泄露溯源、RAM 策略诊断、ActionTrail 审计、服务关联角色检查和攻击黑洞诊断。技能通过打包的 Python 入口脚本调用云 API;只有在客户同意后,才会在实例内派出只读命令探查;所有结论都要求以真实命令输出为证据。

分类:安全
sdk-team
sdk-team
热度 33.35
最近更新 2026-12-01 17:42:47

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add sdk-team/alibabacloud-ecs-security-audit-and-intrusion-response
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
alibabacloud-ecs-security-audit-and-intrusion-response
description
Non-destructive security audit and intrusion response for ECS: brute-force defence check, AK-leak forensics, RAM policy diagnosis, ActionTrail audit, service-linked role checks. Use when (customer wording): block malicious ip; brute force attack on my ecs; many ips accessing my server; ssh failed connections; too many failed login attempts; user account has been locked; granted aliyunecsfullaccess but still denied; no permission to do the action; ram user cannot see ecs instances; resource group authorization not working. Do NOT use for symptoms covered by alibabacloud-ecs-high-frequency-issues (it routes first); non-ECS products. Triggers: "brute force attack on my ecs", "too many failed login attempts", "granted aliyunecsfullaccess but still denied", "ram user cannot see ecs instances", "resource group authorization not working".

alibabacloud-ecs-security-audit-and-intrusion-response

Merged ECS support skill (6 axes, customer-symptom family). Each axis keeps its original full spec; this file is the router and the shared contract layer.

Execution Principle (MANDATORY, applies to every axis)

  • Query-only boundary by default: never create/modify/delete cloud resources unless the axis is listed as GATED below and the customer explicitly confirms the exact action.
  • ABSOLUTE PROHIBITION on authoring or executing any self-written script or wrapper this turn: no heredoc, no ran_scripts/*.sh, no temp .py/.sh, no commands_executed.sh, no hand-assembled bash and no multi-region for region in ... sweep you write yourself. Run ONLY the packaged entry script, or a single read-only aliyun CLI call copied verbatim. Reaching for your own loop instead of the entry script is a read-only-boundary violation, not a shortcut, and it is what makes the run time out. Canonical form (copy and fill the values, never replace the script path): python3 scripts/security-audit-and-intrusion-response.py --axis <axis> [spec flags] or the axis entry script under scripts/axes/<axis>/; do not re-implement its API calls in bash.
  • ABSOLUTE PROHIBITION on fabricating evidence: any conclusion must cite real command output; if a query failed or returned nothing, say so explicitly. Claiming "verified/executed" without trace = violation.
  • ABSOLUTE PROHIBITION on leaking execution-environment internals (office network, egress gateway, local certificates, internal tools/feedback groups) into the customer-facing report.
  • Delivery form (MANDATORY, the only scored artifact this turn): your LAST message must literally be this three-line block, all three lines, inside the last message (not an earlier message, not a file): PRIMARY-CAUSE: <one-line root cause> EVIDENCE (STATUS: <reported|DEGRADED|NOT-READ>): <what you actually read this round - instance/alert/audit/RAM facts; if nothing was read write NOT-READ / not-read + reason> NEXT_ACTION (manual/console): <a concrete manual or console step> Even when the target is not visible or nothing was found, still fill all three lines (state the cause, mark evidence NOT-READ/unverified, give the manual step); do not save a report file and do not end with "saved to .../generated" - files and paths are not scored. A passing last message looks exactly like this (keep the three labels, swap in the values you actually read, keep it under 60 words): PRIMARY-CAUSE: Forbidden.RAM came from a missing policy action, not an ECS fault EVIDENCE (STATUS: reported): read 0 SAS alerts, 12 ActionTrail events, AliyunECSFullAccess attached, 0 explicit deny; NOT-READ for the guest layer NEXT_ACTION (manual/console): a main-account admin adds the missing action in the RAM console; this skill changes nothing When the turn contains a consent or clarification exchange, the message sent AFTER the customer answers is the scored one: repeat all three lines there in full. A one-sentence closing line (e.g. "done / finished / see above") is a violation, however short the work was. The EVIDENCE line carries the entry script's own summary lines verbatim - the product and API names it queried, the resources it read, and every error it recorded (alert counts, ActionTrail events, policy names, ExitCode, instance and disk ids) - so the answer names what was actually checked instead of saying it is finished.
  • Credentials: use the default chain only (env / CLI profile / credentials file). Never print or hardcode AK/SK. ABSOLUTE PROHIBITION on reading ~/.aliyun/config.json, ~/.aliyun/, or ALIBABACLOUD_* / ALICLOUD_* variables to work around an authentication failure: report CREDENTIAL-FAIL-CLOSED: and the customer's own checks instead (exit 3).

Guest Consent and Credential Fail-Closed (MANDATORY, applies to every axis)

In-guest reads are OFF by default. Cloud Assistant RunCommand executes inside the customer's instance. A command that changes nothing still reveals their firewall, listeners, accounts and files, and still write to their task history.

  • MUST obtain the customer's consent for the specific command before dispatching it. Consent for the diagnosis as a whole does not cover a command inside their machine.
  • MUST pass --allow-guest-read to the entry command only after that consent was given in this turn. The dispatcher strips every guest-activation flag otherwise and prints CONSENT-REQUIRED: <axis> / refused flags; the axis's own --confirm token is a second gate on top of this one, never a substitute.
  • MUST NOT re-run with --allow-guest-read on your own initiative. If consent is missing, state which command you would run, what it returns, and ask; if the customer declines, report the affected layer as unverified and hand them the command to run themselves.
  • MUST NOT describe a layer as clean because its guest read did not run.

Credential failure is fail-closed. When the transport cannot authenticate, the entry returns CREDENTIAL-FAIL-CLOSED: with the customer's own check steps and exits 3.

  • ABSOLUTE PROHIBITION: never read ~/.aliyun/config.json, ~/.aliyun/, or any ALIBABACLOUD_* / ALICLOUD_* credential variable, and never ask the customer to paste a key, token or profile file into the conversation. _guardrails.py refuses to spawn a command that carries those paths or names.
  • MUST deliver the CREDENTIAL-FAIL-CLOSED: block's checks verbatim, then stop. Do not substitute guessed cloud state for the missing reads, and do not retry a different way of obtaining credentials.
  • MUST NOT claim "no issue found" when the evidence was unreadable. The answer states which reads failed and what the customer can run to unblock them.

Axis Index (Module Index)

Axis Entry command (keep the scripts/ prefix verbatim) Mode Full spec
bruteforce-defense-guide python3 scripts/security-audit-and-intrusion-response.py --axis bruteforce-defense-guide -- <args> query-only bruteforce-defense-guide
ak-leak-forensics python3 scripts/security-audit-and-intrusion-response.py --axis ak-leak-forensics -- <args> gated ak-leak-forensics
actiontrail-audit python3 scripts/security-audit-and-intrusion-response.py --axis actiontrail-audit -- <args> query-only actiontrail-audit
service-linked-role-guide python3 scripts/security-audit-and-intrusion-response.py --axis service-linked-role-guide -- <args> query-only service-linked-role-guide
attack-blackhole-diagnosis python3 scripts/security-audit-and-intrusion-response.py --axis attack-blackhole-diagnosis -- <args> query-only attack-blackhole-diagnosis
ram-policy-diagnosis python3 scripts/security-audit-and-intrusion-response.py --axis ram-policy-diagnosis -- <args> gated ram-policy-diagnosis

Gated axes in this package: ak-leak-forensics, ram-policy-diagnosis. The gate covers state-changing actions ONLY: those MUST stop and ask for explicit customer confirmation (the axis's confirmation flag: --user-confirmed / --confirmation-scope, or --confirm where the axis defines it) before running; without confirmation, do not mutate anything. Read-style in-guest probes also travel through Cloud Assistant RunCommand. They are NOT query-only from the customer's side: the command still executes inside their machine and leaves a task record there. ABSOLUTE PROHIBITION: never dispatch one without the customer's consent for that exact command in this turn. Ask first, then pass --allow-guest-read to the entry command. Without it the dispatcher strips the axis's guest flags, prints CONSENT-REQUIRED: naming the command it refused, and the cloud-side (Describe/Get) reads still run — so a missing consent degrades the answer instead of blocking it.

When the customer issue matches an axis, run that axis entry command and follow the axis spec in references/axes/<axis>.md. Do not mix axes in one report.

Trigger Conditions

See description (customer wording kept verbatim from the merged intake analysis).

Input Parameters

Per axis: region id / instance id / uid as required by the axis spec; if missing, ask the customer once, never guess.

Execution Flow

  1. Classify the symptom into one axis via the table above.
  2. Run the axis entry command in query-only mode.
  3. Gated axis: stop, present the exact write action, wait for explicit --confirm.
  4. Deliver the report in the axis spec's format.

Observability

Every CLI/API call in this skill attaches the User-Agent template AlibabaCloud-Agent-Skills/{skill}/{session-id} skill-version/{skill-version} (skill = the axis's own skill name, kept for traceability), where session-id is a 32-character hex string generated once per run and reused across all calls in that run (implemented by each axis's _cli.py under scripts/axes/).

Boundary (Do NOT use for)

  • Do NOT use for generic cannot-connect diagnosis (alibabacloud-ecs-diagnose), instance crash or reboot state (the instance-state-diagnosis axis of alibabacloud-ecs-high-frequency-issues), disk IO hangs (the disk-io-diagnosis axis of alibabacloud-ecs-disk-io-and-data-protection), or password-only recovery with no attack signal.
  • Do NOT use for malware/webshell payload cleanup (alibabacloud-mining-attack-diagnosis), instance state faults (the instance-state-diagnosis axis of alibabacloud-ecs-high-frequency-issues), or network reachability (alibabacloud-ecs-vpc-publicnetwork-troubleshoot).
  • Do NOT use for: sub-account policy errors, remote login credential authorization, security-group or mail-port policy requests, web application 403 responses, billing questions, or instance-creator audit lookups.

Important Notes

  • Relative paths only; all assets live in this package.
  • All network/API/subprocess calls carry timeouts.