Back to skill

Security audit

PKU Campus Card

Security checks for vulnerabilities and agentic risk

Overview

The skill is coherent for a PKU campus-card CLI, but it tells agents how to auto-login with stored credentials and exposes payment, recharge, transaction, and OTP workflows without an explicit user-consent checkpoint.

Install only if you are comfortable with an agent helping operate an authenticated PKU campus-card CLI. Require explicit confirmation before login, payment QR generation, recharge, OTP changes, or viewing transaction history, and review how the underlying CLI stores and clears sessions before using it with real credentials.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
SKILL.md:37
Finding

Agent-Triggered Access to Stored Authentication Credentials

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 37-44
Vulnerability Type: Agent-triggered credential access without an explicit consent checkpoint
Risk Level: Medium

Vulnerable Code Snippet

markdown
## Auto-Login for AI Agents

```bash
# Check session status
info-auth check

# Auto-login (reads credentials from OS keyring, no password needed)
campuscard login -p
text

### Technical Analysis

The skill explicitly directs AI agents to execute `campuscard login -p`, which reads authentication credentials from the operating system keyring without requesting a password. No instruction requires the agent to obtain explicit, immediate user approval before accessing those credentials or creating an authenticated session.

Keyring access may be legitimate for an authentication command, but automatically initiating it from an agent crosses a sensitive permission boundary. The resulting session is especially consequential because the documented CLI includes account information, transaction history, payment QR generation, recharge operations, and OTP management.

The project contains only `SKILL.md`; the referenced Rust implementation is absent. Consequently, the audit could not verify whether the executable limits authentication requests to trusted PKU HTTPS hosts, protects credentials and tokens from logs, or requires additional authorization for financial operations.

### Attack Path

1. A user request activates the campus-card skill.
2. The agent follows the documented auto-login workflow and executes `info-auth check`.
3. If authentication is required, the agent runs `campuscard login -p` without a separate user-consent checkpoint.
4. The command retrieves stored credentials from the operating system keyring.
5. The authentication flow exchanges those credentials for a JWT or another authenticated session.
6. The authenticated session can potentially be used to access card details, transa
...[truncated 757 chars]
Remediation
View remediation

Remediation Suggestions

  1. Require explicit user confirmation immediately before any OS-keyring access, even when the user has previously requested a campus-card operation.
  2. Clearly state which credential entry will be accessed, why it is needed, and which authenticated account and service will receive it.
  3. Require separate confirmation before generating payment credentials, recharging funds, changing OTP configuration, or performing any other security-sensitive operation.
  4. Restrict authentication traffic to an explicit allowlist of validated PKU HTTPS origins and reject redirects to untrusted hosts.
  5. Ensure credentials, JWTs, session cookies, OTP secrets, and authorization headers are never written to logs, terminal output, error messages, or subprocess arguments.
  6. Store persisted sessions with least-privilege filesystem permissions and provide clear logout and session-revocation mechanisms.
  7. Add the referenced Rust source code to the review scope so credential handling, TLS validation, redirect behavior, token storage, and transaction authorization controls can be independently audited.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (3)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

Check session status

info-auth check

Auto-login (reads credentials from OS keyring, no password needed)

campuscard login -p

text

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file documents an auto-login flow that accesses stored credentials from the OS keyring, which is a privacy- and security-relevant behavior. The surrounding description explains how to use the command but does not explicitly warn users that saved credentials will be accessed automatically.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The statement 'All user-facing strings in Chinese' imposes a fixed language policy. Under the stated rule, forcing a specific language without user opt-in or clear justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.