T09 · Insecure Skill Coding Practices
- Location
scripts/plan-b-docx-generate.py:50- Finding
Hardcoded Personal Identity and Financial Information
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill matches its Telegram contract workflow purpose, but it handles government ID and banking data with unsafe storage, group disclosure, and hardcoded personal data in source code.
Do not deploy this in production until the source and templates are sanitized, Telegram access is restricted to authorized users, sensitive results are returned privately, debug OCR is disabled or admin-only, and all eID/OCR/contract artifacts have documented permissions, cleanup, and retention controls. Treat the hardcoded personal and banking data in the package as exposed.
scripts/plan-b-docx-generate.py:50Hardcoded Personal Identity and Financial Information
scripts/telegram-planb-bot.js:13Indefinite Plaintext Retention of eID and Contract Data
scripts/telegram-planb-bot.js:210Group-Wide eID Disclosure Without User-Level Authorization
references/clawhub.md:3Unpinned Global Installation of a Third-Party npm Package
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const { execFileSync } = require('child_process');
const TOKEN = process.env.TELEGRAM_BOT_TOKEN || '';
const API = TOKEN ? `https://api.telegram.org/bot${TOKEN}` : '';
const POLL_MS = Number(process.env.TELEGRAM_POLL_INTERVAL_MS || 3000);
const WORKSPACE = process.cwd();
const OUTPUT_DIR = process.env.PLAN_B_OUTPUT_DIR || path.join(WORKSPACE, 'plan-b', 'output');
const TEMPLATE_DOCX = process.env.PLAN_B_TEMPLATE_DOCX || path.join(WORKSPACE, 'plan-b', 'originals', 'talent_individual_original.docx');
const STATE_FILE = path.join(WORKSPACE, '.state', 'telegram-planb-bot.json');
const MANAGEMENT_CHAT_ID = String(process.env.TELEGRAM_MANAGEMENT_CHAT_ID || '');
c
Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.
}
function clearSession(state, chatId, userId) {
if (state.sessions) delete state.sessions[sessionKey(chatId, userId)];
}
function isPhotoMessage(msg) {
The skill explicitly processes Vietnamese electronic ID screenshots, performs OCR on identity fields, and converts them into contract-ready inputs, but it provides no privacy, retention, consent, masking, or access-control guidance. Because this workflow handles highly sensitive personal data (government ID numbers, birth dates, addresses), omission of data-handling safeguards materially increases the risk of unauthorized exposure, over-collection, insecure storage, and accidental sharing in Telegram chats or logs.
The deployment guide instructs operators to place a Telegram bot token and real chat IDs into local environment files but does not warn about secure storage, file permissions, accidental commits, shell history, or log exposure. Because a Telegram bot token grants direct control over the bot and chat IDs reveal internal routing targets, weak handling can lead to bot takeover, message interception, spam, or unauthorized workflow execution.
The guide tells users to send electronic ID/CCCD screenshots through Telegram for OCR testing without any privacy, consent, retention, or data-handling warning. Government ID images contain highly sensitive personal data, and transmitting them through chat workflows and OCR pipelines increases the risk of unauthorized disclosure, retention in chat history, or secondary processing beyond the user's expectations.
The template enforces a specific language/locale for all input fields such as TEN, NGAY_SINH, and THUONG_TRU, and the file does not provide any opt-in, alternative language, or justification for this restriction. Under the stated policy, forcing a specific language without user choice is a natural-language policy violation.
The markdown content is written in Vietnamese, including operational notes and section headings, with no indication that users may choose another language or that the skill is intentionally limited to Vietnamese-speaking users. This can violate language/locale policy when a skill imposes a specific language without opt-in or explicit justification.
This markdown file contains the operational guidance almost entirely in Vietnamese, which effectively forces a specific language for users of the skill. The file does not provide an opt-in, translation alternative, or justification that the skill is intended only for a Vietnamese-speaking or region-specific audience.
The file defines required keys and default contract text entirely in Vietnamese, and generated values such as contract title and location are fixed to a Vietnamese locale. There is no natural-language indication that the locale is optional, user-selectable, or restricted to a justified region-specific deployment.
The script processes highly sensitive personal and financial data including ID number, date of birth, address, phone, email, and bank account, then writes the full mapped payload to disk as a JSON file. Persisting this data in plaintext creates unnecessary exposure through local compromise, backups, shared workstations, logs, or later accidental disclosure.
With no manifest available, the only evident purpose from the file is transforming structured input into contract data and producing a DOCX. Spawning an external process via python3 adds a broader execution capability than is justified by any stated purpose in the provided context, because the file documentation does not declare that it delegates work to another executable.
The script reads OCR output from an identity document and prints the full extracted result to stdout, including highly sensitive personal data such as full name, date of birth, national ID number, addresses, and even the original OCR text. In many agent, CI, or orchestration environments, stdout is captured in logs, terminals, or monitoring systems, which can unintentionally disclose regulated personal data to unauthorized parties.
The script hard-codes recognitionLanguages to ["vi-VN", "en-US"], which imposes specific locale handling on all inputs. Under the policy, language or locale restrictions should either be user-selectable or clearly documented as region-specific and justified.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
const { execFileSync } = require('child_process');
const TOKEN = process.env.TELEGRAM_BOT_TOKEN || '';
const API = TOKEN ? `https://api.telegram.org/bot${TOKEN}` : '';
const POLL_MS = Number(process.env.TELEGRAM_POLL_INTERVAL_MS || 3000);
const WORKSPACE = process.cwd();
const OUTPUT_DIR = process.env.PLAN_B_OUTPUT_DIR || path.join(WORKSPACE, 'plan-b', 'output');
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
const { execFileSync } = require('child_process');
const TOKEN = process.env.TELEGRAM_BOT_TOKEN || '';
const API = TOKEN ? `https://api.telegram.org/bot${TOKEN}` : '';
const POLL_MS = Number(process.env.TELEGRAM_POLL_INTERVAL_MS || 3000);
const WORKSPACE = process.cwd();
const OUTPUT_DIR = process.env.PLAN_B_OUTPUT_DIR || path.join(WORKSPACE, 'plan-b', 'output');
OCR output is written to a JSON artifact on disk, which can contain extracted ID numbers, names, birth dates, and other personal data. Persisting these artifacts locally without notice or retention controls creates a meaningful confidentiality risk, especially because this bot is specifically designed to process government ID data.
The bot downloads CCCD ID images to local disk and stores session state around them without informing users about retention or handling. Because this workflow processes highly sensitive identity data, undisclosed local persistence increases the risk of privacy breaches, unauthorized reuse, and forensic recovery from the host.
The /start response says the management chat is mapped to 'Plan A (management/employee reminders)' and later says the group is used to receive 'management/employee' reports. However, the management branch contains no reminder or reporting logic beyond returning informational text. This is an active intent mismatch in user-facing inline documentation.
The script invokes python3 plan-b-docx-generate.py generate ... to perform document generation, but the file contains no prompt, warning, or explanatory comment telling the user that it will execute another local program. For a code-file audit, subprocess execution is safety-relevant when not disclosed anywhere in the script.
The script reads TELEGRAM_BOT_TOKEN from the environment to authenticate with Telegram, but there is no inline explanation or user-facing documentation in this file about its use. Under this rule, access to credentials should include some disclosure unless it is already clearly documented elsewhere.
Detected: suspicious.dangerous_exec, suspicious.env_credential_access