T08 · Insecure Dependencies
- Location
scripts/update_words.py:27- Finding
Automatic Updates Trust Mutable and Unverified Remote Word Lists
- Content
View full analysis
Vulnerability Details
File Location:
scripts/update_words.py:27-44, 65-69, 124-132; automatic invocation atscripts/check.py:214-220
Vulnerability Type: Unverified supply-chain content retrieved from mutable branches
Risk Level: MediumVulnerable Code
python # Upstream raw file URLs SOURCES = [ # konsheng/Sensitive-lexicon ("konsheng/Sensitive-lexicon", "广告类型", "https://raw.githubusercontent.com/konsheng/Sensitive-lexicon/main/Vocabulary/%E5%B9%BF%E5%91%8A%E7%B1%BB%E5%9E%8B.txt"), ("konsheng/Sensitive-lexicon", "政治类型", "https://raw.githubusercontent.com/konsheng/Sensitive-lexicon/main/Vocabulary/%E6%94%BF%E6%B2%BB%E7%B1%BB%E5%9E%8B.txt"), ("konsheng/Sensitive-lexicon", "暴恐词库", "https://raw.githubusercontent.com/konsheng/Sensitive-lexicon/main/Vocabulary/%E6%9A%B4%E6%81%90%E8%AF%8D%E5%BA%93.txt"), ("konsheng/Sensitive-lexicon", "色情词库", "https://raw.githubusercontent.com/konsheng/Sensitive-lexicon/main/Vocabulary/%E8%89%B2%E6%83%85%E8%AF%8D%E5%BA%93.txt"), ("konsheng/Sensitive-lexicon", "涉枪涉爆", "https://raw.githubusercontent.com/konsheng/Sensitive-lexicon/main/Vocabulary/%E6%B6%89%E6%9E%AA%E6%B6%89%E7%88%86.txt"), ("konsheng/Sensitive-lexicon", "其他词库", "https://raw.githubusercontent.com/konsheng/Sensitive-lexicon/main/Vocabulary/%E5%85%B6%E4%BB%96%E8%AF%8D%E5%BA%93.txt"), ("konsheng/Sensitive-lexicon", "补充词库", "https://raw.githubusercontent.com/konsheng/Sensitive-lexicon/main/Vocabulary/%E8%A1%A5%E5%85%85%E8%AF%8D%E5%BA%93.txt"), # bigdata-labs/sensitive-stop-words ("bigdata-labs/sensitive-stop-words", "广告", "https://raw.githubusercontent.com/bigdata-labs/sensitive-stop-words/master/%E5%B9%BF%E5%91%8A.txt"), ("bigdata-labs/sensitive-stop-words", "政治类", "https://raw.githubusercontent.com/bigdata-labs/sensitive-stop-words/master/%E6%94%BF%E6%B2%BB%E7%B1%BB.txt"), ("bigdata-labs/sensitive-stop-words", "色情类", "https://raw.githubusercontent.com/bigdata-labs ...[truncated 4421 chars]- Remediation
View remediation
Remediation Suggestions
- Pin every remote source to an immutable, reviewed Git commit instead of
mainormaster. - Maintain expected SHA-256 hashes or a signed manifest and reject any response that fails verification.
- Require explicit user consent for updates, or make automatic daily updates opt-in rather than part of ordinary scanning.
- Enforce a maximum response size while streaming the download instead of calling unrestricted
resp.read(). - Limit line length, total line count, decoded character count, and final unique word count.
- Validate HTTP status, expected content type, and the final URL after redirects; reject redirects outside the declared
raw.githubusercontent.comhost. - Download into a temporary file, validate all sources, and atomically replace the cache only after validation succeeds.
- Preserve and automatically restore the last-known-good cache if validation fails or an update produces implausible changes.
- Record source commit identifiers and verified hashes in
.update_state.jsonto support auditing and rollback. - Consider shipping a reviewed baseline word list so the scanner remains functional without granting routine network access.
- Pin every remote source to an immutable, reviewed Git commit instead of
