跳转到正文
报告库
用途分类 / 开发辅助

Azure Diagnostics Skill 安全审计

作者说它能做什么(原文)

Debug Azure production issues on Azure using AppLens, Azure Monitor, resource health, and safe triage. WHEN: debug production issues, troubleshoot app service, app service high CPU, app service deployment failure, troubleshoot container apps, troubleshoot functions, troubleshoot AKS, VM RDP, Linux SSH, VM black screen, can't connect to VM, reset VM password, NSG or firewall blocking, kubectl canno

第三方安全检查结论

先别安装或运行

本次检查尚未完成,以下仅展示已取得的结果。

已检查文件
51
发现的风险
3
会不会运行危险命令?检查是否下载程序后直接运行、让他人远程控制电脑,或藏起要运行的命令。发现 1 项风险
高风险

可能让别人远程控制电脑

原文依据:3 处
发现了什么

代码可以建立远程命令连接。连接生效后,对端能够向本机发送命令。

为什么需要注意

如果运行了这段代码,别人可能通过网络给你的电脑下命令,读取文件或修改设置。

这段代码的正常用途

这不是反向 shell。该代码仅在缺少 nc 时,用 Bash 的 `/dev/tcp` 对用户指定的消息服务主机和端口发起连接测试,并在 5 秒后终止未完成的探测;没有把套接字连接到命令解释器,也没有接收或执行远端命令。它仍会产生预期的出站网络连接,用户可将目标限制为已批准的 Azure 命名空间。

这项判断针对展示的代码和适用条件,不表示风险已经实际发生。
scripts/test-messaging-connectivity.sh:108来自代码打开原文件
    # Fallback: bash /dev/tcp with a background timeout.    ( exec 3<>"/dev/tcp/$host/$port" ) >/dev/null 2>&1 &    local pid=$!
查看另外 2 个位置
scripts/test-messaging-connectivity.sh:107来自代码打开原文件
    fi    # Fallback: bash /dev/tcp with a background timeout.    ( exec 3<>"/dev/tcp/$host/$port" ) >/dev/null 2>&1 &    local pid=$!
scripts/test-messaging-connectivity.sh:111来自代码打开原文件
    local waited=0    while kill -0 "$pid" 2>/dev/null; do        sleep 1        waited=$((waited + 1))        if [ "$waited" -ge 5 ]; then            kill "$pid" 2>/dev/null            wait "$pid" 2>/dev/null            return 1        fi
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。发现 2 项风险
中风险

“所有失败 Pod”模式会跨全部命名空间打印应用日志

原文依据:4 处
发现了什么

未提供命名空间时,脚本列出整个集群所有非 Running/Succeeded 的 Pod,并对每个 Pod打印当前和上一次实例日志。生产日志可能含令牌、个人数据、请求内容或内部地址;这些内容会进入代理会话、终端记录或后续复制的诊断报告。

为什么需要注意

具有集群读取权限的调用会扩大数据收集范围,使与当前故障无关的工作负载信息和敏感日志暴露给当前会话的查看者。

风险成立,但这是显式诊断功能,不代表恶意外传。使用 `--all-failing` 且未指定命名空间时,脚本以 `-A` 扫描全部命名空间,然后对每个匹配 Pod 打印当前及上一次实例日志。日志可能包含令牌、个人数据或内部地址,并可能留在终端或代理会话中。用户可要求仅检查指定命名空间/Pod,并在复制诊断结果前脱敏;作者可增加日志内容过滤或单独确认。

scripts/pod-evidence.sh:124来自代码打开原文件
    # Avoids `mapfile`, which is unavailable in Bash 3.2 / macOS.    if [ -n "$NAMESPACE" ]; then        SCAN_ARGS=(-n "$NAMESPACE")    else        SCAN_ARGS=(-A)    fi    set +e    SCAN_OUT=$(kubectl get pods "${SCAN_ARGS[@]}" --field-selector=status.phase!=Running,status.phase!=Succeeded --no-headers -o custom-columns=NS:.metadata.namespace,NAME:.metadata.name 2>/dev/null)    SCAN_RC=$?
查看另外 3 个位置
scripts/pod-evidence.sh:97来自代码打开原文件
    echo "--- LOGS (current, last $TAIL lines) ---"    kubectl logs "$pod" -n "$ns" --tail="$TAIL" 2>&1 || echo "(no current logs)"    echo ""    echo "--- PREV LOGS (previous instance, last $TAIL lines) ---"    if kubectl logs "$pod" -n "$ns" --previous --tail="$TAIL" 2>/dev/null; then        :    else        echo "(no previous-instance logs - pod has not restarted or they were rotated)"    fi
scripts/pod-evidence.sh:147来自代码打开原文件
    echo "Found ${#ROWS[@]} unhealthy pod(s). Collecting evidence for each below."    echo ""    for row in "${ROWS[@]}"; do        [ -z "$row" ] && continue        ns="${row%% *}"        name="${row##* }"        digest_pod "$ns" "$name"    done    echo "pod-evidence: done. Reviewed ${#ROWS[@]} failing pod(s) - use the STATE/EVENTS/LOGS above to pick a fix."
scripts/pod-evidence.sh:149来自代码打开原文件
    echo ""    for row in "${ROWS[@]}"; do        [ -z "$row" ] && continue        ns="${row%% *}"        name="${row##* }"        digest_pod "$ns" "$name"    done
中风险

Function App 关联查询会输出遥测连接字符串,并可能匹配同资源组中的错误资源

原文依据:3 处
发现了什么

首选 ARG 查询仅按资源组把 Function App 与所有 App Insights 组件连接,并投影每个组件的 instrumentation key 和 connection string。指南自己承认这是按资源组匹配,而不是验证真实关联。

为什么需要注意

查询结果可能暴露同资源组内与目标 Function App 无关的遥测凭据和工作区标识,并可能让用户基于错误的 App Insights 数据作出故障判断。

风险成立。所谓“首选”查询把 Function App 与同资源组内全部 App Insights 组件仅按 `rg` 连接,并输出 instrumentation key 和完整 connection string;指南也明确承认这种匹配方式。因此结果可能暴露遥测配置凭据,并把无关组件误认为关联资源。用户可要求避免输出密钥/连接字符串、只返回资源标识,并通过 Function App 的实际设置验证关联关系。

references/functions/README.md:7来自说明文档打开原文件
A single ARG query returns the App Insights name, instrumentation key, connection string, and Log Analytics workspace for a given function app:```bashaz graph query -q "resources | where type =~ 'microsoft.web/sites' and name == '<func-app-name>'| project funcName=name, rg=resourceGroup| join kind=inner (resources | where type =~ 'microsoft.insights/components' | project appiName=name, rg=resourceGroup, instrumentationKey=properties.InstrumentationKey, connectionString=properties.ConnectionString, workspaceId=properties.WorkspaceResourceId) on rg| project funcName, appiName, instrumentationKey, connectionString, workspaceId" -o json```
查看另外 2 个位置
references/functions/README.md:18来自说明文档打开原文件
> 💡 **Tip:** This join matches by resource group. If App Insights is in a different resource group, use the CLI fallback below.
references/functions/README.md:10来自说明文档打开原文件
```bashaz graph query -q "resources | where type =~ 'microsoft.web/sites' and name == '<func-app-name>'| project funcName=name, rg=resourceGroup| join kind=inner (resources | where type =~ 'microsoft.insights/components' | project appiName=name, rg=resourceGroup, instrumentationKey=properties.InstrumentationKey, connectionString=properties.ConnectionString, workspaceId=properties.WorkspaceResourceId) on rg| project funcName, appiName, instrumentationKey, connectionString, workspaceId" -o json```
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。未发现风险
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。未发现风险
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。未发现风险
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。未发现风险

Skill 逻辑拆解

8 个说明模块

该技能用于 Azure 生产故障排查,通常先检查资源健康,再读取日志、指标和近期变更;其总规则要求记录发现及尝试过的修复。

查看原文
SKILL.md:35来自说明文档打开原文件
1. Start with systematic diagnosis flow2. Use AppLens (MCP) for AI-powered diagnostics when available3. Check resource health before deep-diving into logs4. Select appropriate troubleshooting guide based on service type5. Document findings and attempted remediation steps6. Route AKS incidents to the dedicated AKS troubleshooting document

常规 AKS 基线脚本读取 Azure 集群/节点池/活动记录以及 Kubernetes 节点、Pod 和告警事件;可选命名空间参数会额外列出该命名空间的 Pod。

查看原文
scripts/aks-baseline.sh:83来自代码打开原文件
section "1. Cluster provisioning state"run "cluster provisioning state" \    az aks show -g "$RESOURCE_GROUP" -n "$CLUSTER" ${AZ_SUB_ARGS[@]+"${AZ_SUB_ARGS[@]}"} \        --query "{name:name, provisioningState:provisioningState, powerState:powerState.code, k8sVersion:currentKubernetesVersion, fqdn:fqdn}" \        -o table# 2. Node pool summary ---------------------------------------------------------section "2. Node pool summary"run "node pool summary" \    az aks nodepool list -g "$RESOURCE_GROUP" --cluster-name "$CLUSTER" ${AZ_SUB_ARGS[@]+"${AZ_SUB_ARGS[@]}"} \        --query "[].{name:name, mode:mode, count:count, vmSize:vmSize, state:provisioningState, powerState:powerState.code, k8sVersion:orchestratorVersion}" \        -o table# 3. Recent Azure activity -----------------------------------------------------section "3. Recent Azure activity (last 20 events)"run "recent activity log" \    az monitor activity-log list -g "$RESOURCE_GROUP" ${AZ_SUB_ARGS[@]+"${AZ_SUB_ARGS[@]}"} \        --max-events 20 \        --query "[].{time:eventTimestamp, operation:operationName.value, status:status.value, resource:resourceId}" \        -o table
scripts/aks-baseline.sh:103来自代码打开原文件
# 4. Node readiness ------------------------------------------------------------section "4. Node readiness"run "node readiness" kubectl get nodes -o wide# 5. Unhealthy pods ------------------------------------------------------------# Filter on the READY and STATUS columns (not just pod phase) so container-level# failures such as CrashLoopBackOff / ImagePullBackOff — which stay in phase# "Running" — are caught. Terminal pods (Completed/Succeeded) are excluded so# finished jobs are not falsely flagged.section "5. Unhealthy pods (CrashLoopBackOff, not Ready, restarting, or bad status)"ALL_PODS="$(kubectl get pods -A -o wide 2>/dev/null)"if [ -z "$ALL_PODS" ]; then
scripts/aks-baseline.sh:135来自代码打开原文件
# 6. kube-system health --------------------------------------------------------section "6. kube-system health"run "kube-system pods" kubectl get pods -n kube-system -o wide# 7. Recent warning events -----------------------------------------------------section "7. Recent warning events (last 40, sorted by time)"run "warning events" bash -c \    "set -o pipefail; kubectl get events -A --field-selector=type=Warning --sort-by=.lastTimestamp 2>/dev/null | tail -n 40"# 8. Namespace pod overview (optional) ----------------------------------------if [ -n "$NAMESPACE" ]; then    section "8. Pods in namespace '$NAMESPACE'"    run "pods in namespace $NAMESPACE" kubectl get pods -n "$NAMESPACE" -o widefi

App Service 和 Container Apps 的组合脚本从当前 Azure CLI 身份读取配置、部署、域名或运行日志并打印到标准输出;未发现这些脚本上传结果的指令。

查看原文
scripts/appservice-diagnostics.sh:69来自代码打开原文件
echo "--- Recent Deployments (last 3) ---"az webapp deployment list -n "$APP" -g "$RG" "${SUB_ARGS[@]}" \    --query "[:3].{id:id, status:status, time:end_time}" -o table || echo "(failed to list deployments)"echo ""echo "--- App Settings (names only) ---"az webapp config appsettings list -n "$APP" -g "$RG" "${SUB_ARGS[@]}" \    --query "[].name" -o tsv || echo "(failed to list app settings)"echo ""echo "--- Custom Domains ---"az webapp config hostname list -g "$RG" --webapp-name "$APP" "${SUB_ARGS[@]}" -o table || echo "(failed to list custom domains)"echo ""
scripts/containerapp-diagnostics.sh:67来自代码打开原文件
echo "--- Registry Config ---"az containerapp show --name "$APP" -g "$RG" "${SUB_ARGS[@]}" \    --query "properties.configuration.registries" || echo "(failed to read registry config)"echo ""echo "--- Ingress Config ---"az containerapp show --name "$APP" -g "$RG" "${SUB_ARGS[@]}" \    --query "properties.configuration.ingress" || echo "(failed to read ingress config)"echo ""echo "--- Recent Logs (last 20 lines) ---"az containerapp logs show --name "$APP" -g "$RG" "${SUB_ARGS[@]}" --tail 20 || echo "(failed to read logs)"echo ""

VM 与 AKS 指南明确把重启、删除、扩缩容、升级、凭据重置和扩展命令视为需要额外检查或用户批准的操作。

查看原文
troubleshooting/aks/aks-troubleshooting.md:112来自说明文档打开原文件
## Guardrails- default to read-only diagnostics- do not restart, delete, cordon, drain, scale, upgrade, or reconfigure resources unless the user explicitly asks for remediation- do not conclude root cause without quoting the evidence that supports it
troubleshooting/compute/vm-troubleshooting.md:29来自说明文档打开原文件
## Guardrails- Default to read-only diagnostics; quote evidence before concluding root cause.- Do not run extension-backed commands (`az vm user update`, `az vm user reset-ssh`, `az vm user reset-remote-desktop`, `az vm run-command invoke`) until [Pre-Flight Safety Checks](references/cannot-connect-to-vm.md#pre-flight-safety-checks) pass.- Do not restart, redeploy, deallocate, or delete unless the user explicitly approves remediation.- If multiple issues appear, fix network-layer blockers before agent-dependent fixes.
从这里开始 · 工作说明SKILL.md
azure-diagnostics
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。

文件引用关系图

40 处引用
哪些文件发起引用引用了什么
连线表示真实的文件引用,不是运行顺序。点击节点可高亮相关连线,并查看具体文件和原文位置。虚线表示还有文件需要定位。
文件与检查记录51 个文件

检查范围与遗漏

  • 有检测结果未通过证据校验或未完成处理,本报告不能代表完整检查。
逐文件查看涉及的内容

下方列出本次涉及的原文范围;纳入检查不代表已查清所有问题。

  • SKILL.md已纳入全文
  • scripts/aks-baseline.ps1已纳入全文
  • scripts/aks-baseline.sh已纳入全文
  • scripts/appservice-diagnostics.ps1已纳入全文
  • scripts/appservice-diagnostics.sh已纳入全文
  • scripts/containerapp-diagnostics.ps1已纳入全文
  • scripts/containerapp-diagnostics.sh已纳入全文
  • scripts/pod-evidence.ps1已纳入全文
  • scripts/pod-evidence.sh已纳入全文
  • scripts/run-ig.ps1已纳入全文
  • scripts/run-ig.sh已纳入全文
  • scripts/test-messaging-connectivity.ps1已纳入全文
  • scripts/test-messaging-connectivity.sh已纳入全文
  • references/app-service/README.md已纳入全文
  • references/azure-resource-graph.md已纳入全文
  • references/container-apps/README.md已纳入全文
  • references/functions/README.md已纳入全文
  • references/kql-queries.md已纳入全文
  • troubleshooting/aks/aks-troubleshooting.md已纳入全文
  • troubleshooting/compute/vm-troubleshooting.md已纳入全文
  • troubleshooting/messaging/README.md已纳入全文
  • troubleshooting/aks/general-diagnostics.md已纳入全文
  • troubleshooting/aks/load-balancer-and-ingress.md已纳入全文
  • troubleshooting/aks/network-policy.md已纳入全文
  • troubleshooting/aks/networking.md已纳入全文
  • troubleshooting/aks/node-issues.md已纳入全文
  • troubleshooting/aks/pod-failures.md已纳入全文
  • troubleshooting/aks/references/aks-mcp.md已纳入全文
  • troubleshooting/aks/references/command-flows.md已纳入全文
  • troubleshooting/aks/references/inspektor-gadget.md已纳入全文
  • troubleshooting/aks/references/structured-input-modes.md已纳入全文
  • troubleshooting/aks/spot-and-zone-issues.md已纳入全文
  • troubleshooting/aks/upgrade-operations.md已纳入全文
  • troubleshooting/compute/references/cannot-connect-to-vm.md已纳入全文
  • troubleshooting/compute/references/credential-auth-errors.md已纳入全文
  • troubleshooting/compute/references/firewall-blocking.md已纳入全文
  • troubleshooting/compute/references/network-connectivity.md已纳入全文
  • troubleshooting/compute/references/rdp-connectivity.md已纳入全文
  • troubleshooting/compute/references/rdp-service-config.md已纳入全文
  • troubleshooting/compute/references/ssh-connectivity.md已纳入全文
  • troubleshooting/compute/references/vm-agent-not-responding.md已纳入全文
  • troubleshooting/messaging/auth-best-practices.md已纳入全文
  • troubleshooting/messaging/azure-eventhubs-dotnet.md已纳入全文
  • troubleshooting/messaging/azure-eventhubs-java.md已纳入全文
  • troubleshooting/messaging/azure-eventhubs-js.md已纳入全文
  • troubleshooting/messaging/azure-eventhubs-py.md已纳入全文
  • troubleshooting/messaging/azure-servicebus-dotnet.md已纳入全文
  • troubleshooting/messaging/azure-servicebus-java.md已纳入全文
  • troubleshooting/messaging/azure-servicebus-js.md已纳入全文
  • troubleshooting/messaging/azure-servicebus-py.md已纳入全文
  • troubleshooting/messaging/service-troubleshooting.md已纳入全文

这份报告只针对上方版本。我们看了拿到的代码和说明文件,没有实际运行 Skill,也没有检查它另外安装的软件包。因此,这不是“保证安全”的承诺;换了版本或使用环境,结果也可能不同。

  • SKILL.md工作说明
  • references/app-service/README.md配套文件
  • references/azure-resource-graph.md配套文件
  • references/container-apps/README.md配套文件
  • references/functions/README.md配套文件
  • references/kql-queries.md配套文件
  • scripts/aks-baseline.ps1脚本
  • scripts/aks-baseline.sh脚本
  • scripts/appservice-diagnostics.ps1脚本
  • scripts/appservice-diagnostics.sh脚本
  • scripts/containerapp-diagnostics.ps1脚本
  • scripts/containerapp-diagnostics.sh脚本
  • scripts/pod-evidence.ps1脚本
  • scripts/pod-evidence.sh脚本
  • scripts/run-ig.ps1脚本
  • scripts/run-ig.sh脚本
  • scripts/test-messaging-connectivity.ps1脚本
  • scripts/test-messaging-connectivity.sh脚本
  • troubleshooting/aks/aks-troubleshooting.md配套文件
  • troubleshooting/aks/general-diagnostics.md配套文件
  • troubleshooting/aks/load-balancer-and-ingress.md配套文件
  • troubleshooting/aks/network-policy.md配套文件
  • troubleshooting/aks/networking.md配套文件
  • troubleshooting/aks/node-issues.md配套文件
  • troubleshooting/aks/pod-failures.md配套文件
  • troubleshooting/aks/references/aks-mcp.md配套文件
  • troubleshooting/aks/references/command-flows.md配套文件
  • troubleshooting/aks/references/inspektor-gadget.md配套文件
  • troubleshooting/aks/references/structured-input-modes.md配套文件
  • troubleshooting/aks/spot-and-zone-issues.md配套文件
  • troubleshooting/aks/upgrade-operations.md配套文件
  • troubleshooting/compute/references/cannot-connect-to-vm.md配套文件
  • troubleshooting/compute/references/credential-auth-errors.md配套文件
  • troubleshooting/compute/references/firewall-blocking.md配套文件
  • troubleshooting/compute/references/network-connectivity.md配套文件
  • troubleshooting/compute/references/rdp-connectivity.md配套文件
  • troubleshooting/compute/references/rdp-service-config.md配套文件
  • troubleshooting/compute/references/ssh-connectivity.md配套文件
  • troubleshooting/compute/references/vm-agent-not-responding.md配套文件
  • troubleshooting/compute/vm-troubleshooting.md配套文件
  • troubleshooting/messaging/README.md配套文件
  • troubleshooting/messaging/auth-best-practices.md配套文件
  • troubleshooting/messaging/azure-eventhubs-dotnet.md配套文件
  • troubleshooting/messaging/azure-eventhubs-java.md配套文件
  • troubleshooting/messaging/azure-eventhubs-js.md配套文件
  • troubleshooting/messaging/azure-eventhubs-py.md配套文件
  • troubleshooting/messaging/azure-servicebus-dotnet.md配套文件
  • troubleshooting/messaging/azure-servicebus-java.md配套文件
  • troubleshooting/messaging/azure-servicebus-js.md配套文件
  • troubleshooting/messaging/azure-servicebus-py.md配套文件
  • troubleshooting/messaging/service-troubleshooting.md配套文件

代码和说明中提到的操作

运行命令
scripts/aks-baseline.sh:1来自代码打开原文件
#!/usr/bin/env bash# aks-baseline.sh
scripts/aks-baseline.sh:141来自代码打开原文件
section "7. Recent warning events (last 40, sorted by time)"run "warning events" bash -c \    "set -o pipefail; kubectl get events -A --field-selector=type=Warning --sort-by=.lastTimestamp 2>/dev/null | tail -n 40"
scripts/appservice-diagnostics.sh:1来自代码打开原文件
#!/usr/bin/env bash# appservice-diagnostics.sh
连接外部网站
scripts/test-messaging-connectivity.ps1:91来自代码打开原文件
    try {        $resp = Invoke-WebRequest -Uri "https://$fqdn/" -Method Get -TimeoutSec 15 `            -UseBasicParsing -ErrorAction Stop
scripts/test-messaging-connectivity.sh:134来自代码打开原文件
# On success the namespace returns an Atom feed or HTTP 401 — either proves the# endpoint is reachable. A connection failure (curl exit != 0) means blocked.https_result() {
scripts/test-messaging-connectivity.sh:136来自代码打开原文件
https_result() {    if ! command -v curl >/dev/null 2>&1; then        # No curl: fall back to a plain TCP probe of 443.
读取密钥或账号配置
scripts/pod-evidence.sh:134来自代码打开原文件
    if [ "$SCAN_RC" -ne 0 ]; then        echo "ERROR: unable to list pods (kubectl exited $SCAN_RC). Check your cluster context and credentials." >&2        exit 1
references/container-apps/README.md:7来自说明文档打开原文件
|---------|--------------|-----------|| Image pull failure | ACR credentials missing | `az containerapp registry set --identity system` || ACR build fails | ACR Tasks disabled (free sub) | Build locally with Docker |
references/container-apps/README.md:81来自说明文档打开原文件
- Dockerfile `EXPOSE` statement- `process.env.PORT` or hardcoded port in app
修改文件
troubleshooting/aks/networking.md:17来自说明文档打开原文件
# Only use it after the user explicitly approves a mutating test.kubectl run netdebug --image=curlimages/curl -it --rm -n <ns> -- \  curl -sv http://<service>.<ns>.svc.cluster.local:<port>/healthz
troubleshooting/aks/networking.md:57来自说明文档打开原文件
# Optional live DNS test from the same namespace as the failing podkubectl run dnstest --image=busybox:1.28 -it --rm -n <ns> -- \  nslookup <service-name>.<ns>.svc.cluster.local
读取了多少行
4,528
文件校验值(用于核对版本)
d2bff75f15ff73a9468f426ec87337daf97faebb439faef80afe01a9ed95fe9f