The analysis of commit 28dfce3 revealed fixes for five distinct vulnerabilities in the skillctl tool. The root causes were primarily a lack of input validation and sanitization across different components of the application, leading to a range of security issues from command injection to denial of service and information disclosure.
-
Argument Injection (CVE-2024-XXXX-1): The source_sha from .skills.toml was used directly in a git ls-tree command. The fix in skillctl::project_config::InstalledSkill::validate now ensures this value is a valid hex SHA, preventing the injection of command-line flags.
-
Path Traversal (CVE-2024-XXXX-2): The --dest argument in the add command was not validated, allowing an attacker to specify arbitrary paths. The fix in skillctl::commands::add::resolve_destination now prohibits path traversal (..) and absolute paths in non-interactive modes.
-
Denial of Service & Information Disclosure (CVE-2024-XXXX-3, CVE-2024-XXXX-4): The skillctl::fs_util::copy_dir_all function was vulnerable in two ways. It didn't check for special file types, leading to a DoS when encountering a FIFO or device file. It also didn't check for hardlinks, allowing an attacker to exfiltrate file content. The patch adds checks for both file types and hardlink counts (nlink > 1).
-
CRLF Injection (CVE-2024-XXXX-5): The application was vulnerable to commit-trailer forgery. Skill names, descriptions, tags, and user-supplied commit messages were not sanitized, allowing newline characters. This could be used to inject fake Co-Authored-By: trailers into commits. The fixes are spread across skillctl::skill::discover and skillctl::commands::push::run, which now use new sanitization functions to validate these inputs.
By identifying the functions where these validation and sanitization checks were added, we can pinpoint the exact locations of the vulnerabilities in the codebase.