T09 · Insecure Skill Coding Practices
- Location
nex-skillmon.py:260- Finding
Integrity checks compare files against a newly generated baseline and omit hidden files
- Content
View full analysis
List[Dict[str, Any]]: """Scan the skills directory for installed skills.""" skills = [] if not self.base_dir.exists(): logger.warning(f"Skills directory does not exist: {self.base_dir}") return skills # Find all SKILL.md files skill_md_files = list(self.base_dir.glob("*/SKILL.md")) for skill_md in skill_md_files: skill_dir = skill_md.parent skill_info = self._parse_skill_metadata(skill_md) if skill_info: skill_info["skill_path"] = str(skill_dir) skill_info["file_hash"] = self._calculate_directory_hash(skill_dir) skill_info["install_date"] = self._get_install_date(skill_dir) ``` That newly calculated hash is then passed immediately to `verify_file_integrity()` as the purported stored baseline: ```python else: skill_list = scanner.scan_installed_skills() for skill in skill_list: print(f"Checking {skill['name']}...") # Check updates updates = scanner.check_for_updates( skill["name"], skill.get("version", "unknown") ) # Check security security = scanner.check_security_flags(skill["name"]) # Check integrity integrity = scanner.verify_file_integrity( skill["skill_path"], skill.get("file_hash") ) if not integrity["integrity_ok"]: print(f" ✗ INTEGRITY CHANGED") ``` Consequently, the common `nex-skillmon check` workflow compares the current directory hash with the same current directory hash. Modifications made after an earlier scan are not detected. The hashing implementation al ...[truncated 1981 chars]- Remediation
View remediation
