# Inclusion of Functionality from Untrusted Control Sphere (CWE-829) The product imports, requires, or includes executable functionality from a source that is outside of the intended control sphere. **Stack:** Kubernetes - Prevalence: 高 频繁被利用 - Impact: 高 3 条严重级别为高的规则 - Prevention: 已记录 4 个修复示例 **OWASP:** Vulnerable and Outdated Components (A06:2021-Vulnerable and Outdated Components) - #6 ## Description When software includes functionality from untrusted sources (such as third-party scripts, external modules, or code from untrusted URLs), attackers can inject malicious code that will be executed with the same privileges as the application. ## Prevention 基于 1 条 Shoulder 检测规则的 Inclusion of Untrusted Functionality 预防策略。 ### Kubernetes Pin container images to specific version tags or SHA digests for reproducible deployments ## Warning Signs - [MEDIUM] Container image uses 'latest' tag or no tag. - [MEDIUM] container images using 'latest' tag or no tag ## Consequences - 执行未授权代码 - 读取应用程序数据 - 修改应用程序数据 ## Mitigations - 只引入来自可信、经验证来源的代码 - 对外部脚本使用 Subresource Integrity (SRI) - 实施 Content Security Policy (CSP) 来限制可执行代码的来源 ## Detection - Total rules: 4 - Languages: go, javascript, typescript, yaml, python ## Rules by Language ### Yaml (1 rules) - **Container Using Latest Tag** [MEDIUM]: Detects container images using 'latest' tag or no tag. - Remediation: Use specific image tags for production. ```yaml containers: - name: app image: nginx:1.21.6-alpine ``` Learn more: https://shoulder.dev/learn/kubernetes/cwe-829/image-latest-tag