Back to skill

Security audit

gitlab-work-stats

Security checks for vulnerabilities and agentic risk

Overview

This skill is meant for read-only GitLab reporting, but it asks for powerful server and database access with unsafe SSH, SQL, and credential-handling patterns.

Review before installing. Use only with explicit authorization, a dedicated least-privilege read-only GitLab account, verified SSH host keys, pinned dependencies, and secrets stored outside the project directory. Do not use the provided SQL patterns with untrusted usernames, dates, or keywords until they are replaced with real parameterization and a technically enforced read-only database role.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
Findings (6)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:112
Finding

SQL Injection Through Interpolated User-Controlled Query Parameters

Content
View full analysis
= '{start_date}' AND mr.created_at < '{end_date}' ``` The SQL is subsequently passed to `psql`: ```python def pg_query(ssh, sql): cmd = '/opt/gitlab/embedded/bin/psql ' \ '-h /var/opt/gitlab/postgresql ' \ '-d gitlabhq_production ' \ f'-c {shlex.quote(sql)} 2>&1' stdin, stdout, stderr = ssh.exec_command(cmd, timeout=60) return stdout.read().decode('utf-8', errors='replace') ``` ### Technical Analysis Values such as `username`, `keyword`, `start_date`, and `end_date` are inserted directly into SQL strings. A malicious value containing quotes and SQL operators can therefore change the structure of the resulting query. The use of `shlex.quote(sql)` only prevents the local shell from interpreting the SQL string as shell syntax. It does not provide SQL parameterization, escaping, statement restrictions, or protection against PostgreSQL injection. The documentation states that queries must be read-only, but the shown helper does not technically enforce that restriction. If the database account has write or administrative privileges, injected statements may execute with those privileges. ### Attack Path 1. An attacker supplies a crafted target username, keyword, or date value. 2. The Skill substitutes that value into one of the SQL templates. 3. For example, a username resembling `' OR 1=1 --` changes the identity lookup condition. 4. The altered S ...[truncated 849 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:77
Finding

SSH Host-Key Verification Is Disabled

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
references/server-config.json:1
Finding

Plaintext Credential Fields in a Project-Local Configuration File

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
SKILL.md:112
Finding

Collection of Unnecessary Last Sign-In Metadata

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
references/database-guide.md:165
Finding

Over-Broad Production Database and Repository Metadata Access

Content
View full analysis
= '{start}' AND mr.created_at < '{end}' LEFT JOIN events e ON e.author_id = u.id AND e.created_at >= '{start}' AND e.created_at < '{end}' GROUP BY u.id, u.username, u.name ORDER BY mr_count DESC NULLS LAST LIMIT 20; ``` The Skill additionally obtains physical repository paths and invokes Git across every reference: ```bash REPO="/var/opt/gitlab/git-data/repositories/{disk_path}.git" /opt/gitlab/embedded/bin/git -C "$REPO" \ log --all --author='{username}' \ --since='{start_date}' --until='{end_date}' \ --format='%h|%ai|%s' ``` ### Technical Analysis The stated task is to produce statistics for one authorized user over a defined period. Instance-wide entity counts, webhook-table access, organization-wide activity rankings, physical repository path discovery, and `git log --all` exceed the minimum access needed for that purpose. The design relies on policy statements instructing the operator to remain read-only. It does not establish a technical permission boundary restricting the database role to one us ...[truncated 1409 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
SKILL.md:74
Finding

Unpinned Third-Party Dependency Installation

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (17)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill documentation is entirely written in Chinese and presents all activation phrases and operating instructions only in Chinese, with no indication that other languages are supported or that the language choice is optional. This can violate a language/locale policy when users are not given an explicit opt-in or alternative.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · README.md (reported line 61)May include surrounding context.

md
| 版本 | 日期 | 作者 | 变更 |
|------|------|------|------|
| 1.1.0 | 2026-07-24 | — | 安全修复:移除硬编码凭据、sudo 链式执行、email 字段收集 |
| 1.0.0 | 2026-07-23 | — | 初始版本 |

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 100)May include surrounding context.

md
| 版本 | 日期 | 作者 | 变更 |
|------|------|------|------|
| 1.1.0 | 2026-07-24 | — | 安全修复:移除硬编码凭据、sudo 链式执行、email 字段收集 |
| 1.0.0 | 2026-07-23 | — | 初始版本 |

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 103)May include surrounding context.

md
| 版本 | 日期 | 作者 | 变更 |
|------|------|------|------|
| 1.1.0 | 2026-07-24 | — | 安全修复:移除硬编码凭据、sudo 链式执行、email 字段收集 |
| 1.0.0 | 2026-07-23 | — | 初始版本 |

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 272)May include surrounding context.

md
| 版本 | 日期 | 作者 | 变更 |
|------|------|------|------|
| 1.1.0 | 2026-07-24 | — | 安全修复:移除硬编码凭据、sudo 链式执行、email 字段收集 |
| 1.0.0 | 2026-07-23 | — | 初始版本 |

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 427)May include surrounding context.

md
| 版本 | 日期 | 作者 | 变更 |
|------|------|------|------|
| 1.1.0 | 2026-07-24 | — | 安全修复:移除硬编码凭据、sudo 链式执行、email 字段收集 |
| 1.0.0 | 2026-07-23 | — | 初始版本 |

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest description and document title are entirely in Chinese, and the report template later in the file is also defined in Chinese, indicating the skill operates in a fixed language. The policy for this audit flags language/locale constraints when the skill does not explicitly offer the user a language choice or justify the locale restriction.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 93)May include surrounding context.

GitLab Omnibus 默认使用内置 PostgreSQL,通过 Unix Socket 连接(不监听 TCP 端口),使用 peer 认证(无需密码)。

连接方式(通过 socket + peer 认证,以当前 SSH 用户身份直接执行,不使用 sudo 提权):

bash
/opt/gitlab/embedded/bin/psql   -h /var/opt/gitlab/postgresql -d gitlabhq_production -c "SQL语句"

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 284)May include surrounding context.

GitLab Omnibus 默认使用内置 PostgreSQL,通过 Unix Socket 连接(不监听 TCP 端口),使用 peer 认证(无需密码)。

连接方式(通过 socket + peer 认证,以当前 SSH 用户身份直接执行,不使用 sudo 提权):

bash
/opt/gitlab/embedded/bin/psql   -h /var/opt/gitlab/postgresql -d gitlabhq_production -c "SQL语句"

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/database-guide.md (reported line 219)May include surrounding context.

GitLab Omnibus 默认使用内置 PostgreSQL,通过 Unix Socket 连接(不监听 TCP 端口),使用 peer 认证(无需密码)。

连接方式(通过 socket + peer 认证,以当前 SSH 用户身份直接执行,不使用 sudo 提权):

bash
/opt/gitlab/embedded/bin/psql   -h /var/opt/gitlab/postgresql -d gitlabhq_production -c "SQL语句"

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/database-guide.md (reported line 226)May include surrounding context.

GitLab Omnibus 默认使用内置 PostgreSQL,通过 Unix Socket 连接(不监听 TCP 端口),使用 peer 认证(无需密码)。

连接方式(通过 socket + peer 认证,以当前 SSH 用户身份直接执行,不使用 sudo 提权):

bash
/opt/gitlab/embedded/bin/psql   -h /var/opt/gitlab/postgresql -d gitlabhq_production -c "SQL语句"

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill is presented as a read-only work statistics generator, but these steps instruct collection of comment text and AI review content previews, which expands processing from aggregate statistics into potentially sensitive content inspection. That creates a scope mismatch and increases privacy risk because reviewers' comments, approvals, and AI findings may contain confidential code, security, or personnel information not necessary for basic statistics.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The report requirements direct the agent to infer work themes, technical direction, and implementation decisions from commit and MR titles, going beyond neutral statistical reporting into behavioral and project-content analysis. This can expose sensitive project context and employee profiling information that users may not expect from a tool described as producing work statistics.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The document expands a read-only GitLab work-statistics skill from database querying into SSH-based local repository access using on-disk hashed storage paths. Even though the example is framed as read-only and avoids sudo, it enables access to repository data outside the stated minimal scope, increasing the attack surface and creating a path to retrieve more than intended if the executing account has broad filesystem access.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The entire report template, including headings and instructional text, is written only in Chinese, which implies a fixed output language. Under the policy rule, a skill should not force a specific language or locale unless it offers user choice or clearly documents a justified locale constraint.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

Manifest 将技能描述为生成指定用户在指定时间段内的合并请求、提交和代码审查活动统计报告,强调的是只读分析统计。该模板却明确要求输出“AI 代码审查”结果和“关键发现/风险与关注点”,这更像对代码内容进行质量或安全审查,而非单纯活动统计,属于描述范围外的行为意图。

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

The implementation example for SQL execution constructs the command with shlex.quote(sql) and sends it directly to psql -c, while the later documentation states that base64 encoding is used to handle multi-line SQL. This is an active contradiction between the explanatory text and the actual documented implementation approach.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.