Back to skill

Security audit

Calculus Concept Visualizer

Security checks for vulnerabilities and agentic risk

Overview

This calculus teaching skill is mostly purpose-aligned, but one plotting tool can run user-supplied math text as Python code on the local machine.

Review before installing. Only use this skill in a restricted environment and avoid passing untrusted function strings until the eval usage is replaced with a safe, allowlisted math expression parser. Also check where auto-saved visualizations and student interaction data are stored and how they can be deleted.

Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (15)

eval() call detected

High
Category
Dangerous Code Execution
Content
fig, ax = plt.subplots(figsize=(10, 6))

        f = eval(f"lambda x: {function_str}")

        # 绘制函数
        x_smooth = np.linspace(a, b, 200)
Confidence
99% confidence
Finding
This code builds a lambda from a user-controlled string using eval, which allows arbitrary Python code execution in the process context rather than merely evaluating a math expression. In an educational plotting tool, that capability is unnecessary and materially expands the attack surface to file access, subprocess execution, and environment inspection.

eval() call detected

High
Category
Dangerous Code Execution
Content
x = x[x != a]  # 排除间断点

        try:
            f = eval(f"lambda x: {function_str}")
            y = f(x)
        except:
            y = np.sin(x)/x
Confidence
99% confidence
Finding
The limit demonstration path evaluates a user-provided function string with eval, enabling arbitrary code execution under the application's privileges. The surrounding try/except does not mitigate the issue because malicious code can execute before any exception is raised.

eval() call detected

High
Category
Dangerous Code Execution
Content
fig, ax = plt.subplots(figsize=(8, 6))

            x = np.linspace(-2, 4, 200)
            f = eval(f"lambda x: {function_str}")
            y = f(x)

            ax.plot(x, y, 'b-', linewidth=2, label='f(x)')
Confidence
99% confidence
Finding
The derivative animation repeatedly evaluates untrusted input with eval inside a frame-generation loop, so a malicious expression can run arbitrary code multiple times. That increases both exploit reliability and potential damage, including repeated side effects or denial of service.

eval() call detected

High
Category
Dangerous Code Execution
Content
x = np.linspace(-np.pi, np.pi, 200)

        try:
            f = eval(f"lambda x: {function_str}")
            y_exact = f(x)
        except:
            y_exact = np.sin(x)
Confidence
99% confidence
Finding
The Taylor comparison path also uses eval on user-supplied input, creating the same arbitrary code execution risk as the other plotting modes. Even though there is a fallback to sin(x), harmful code may already have run before control reaches the exception handler.

Context-Inappropriate Capability

High
Confidence
99% confidence
Finding
This is a true vulnerability because the skill executes user-supplied function strings as Python code, which is unrelated to the declared calculus-visualization purpose. The skill context makes this more dangerous, not less, because users reasonably expect mathematical input to be interpreted as formulas, not executable code.

Context-Inappropriate Capability

High
Confidence
99% confidence
Finding
The derivative visualization unnecessarily grants arbitrary execution through user input while presenting itself as an instructional graphics feature. Because the code runs in a loop for multiple frames, exploitation can trigger repeated commands or expensive computation, worsening impact.

Context-Inappropriate Capability

High
Confidence
99% confidence
Finding
Riemann-sum plotting should only need numeric function evaluation, but it currently interprets arbitrary Python expressions from the user. That introduces code execution capabilities far beyond the tool's educational scope and could be used to access local resources or run system commands.

Context-Inappropriate Capability

High
Confidence
99% confidence
Finding
The Taylor comparison feature enables arbitrary code execution via a function field even though its purpose is pedagogical visualization. This mismatch between user expectation and actual capability is security-relevant because users or integrators may pass untrusted formulas assuming they are harmless.

Missing User Warnings

Medium
Confidence
82% confidence
Finding
The configuration enables automatic saving of generated visualizations without any visible consent flow or warning. In an educational assistant, saved visualizations can contain student-provided inputs, learning artifacts, or inferred cognitive state data, so silent persistence creates a real privacy and data-governance risk even if the feature is intended for convenience.

Unpinned Dependencies

Low
Category
Supply Chain
Content
# Python >= 3.8

# 数值计算
numpy>=1.20.0

# 可视化
matplotlib>=3.5.0
Confidence
88% confidence
Finding
Using a lower-bound-only specifier for numpy allows installation of any newer release, including versions with breaking changes or future vulnerable releases. In a supply-chain context this weakens reproducibility and makes dependency risk harder to control, even though the file itself does not pin a known-bad version.

Unpinned Dependencies

Low
Category
Supply Chain
Content
numpy>=1.20.0

# 可视化
matplotlib>=3.5.0
plotly>=5.0.0

# 符号数学(可选)
Confidence
88% confidence
Finding
The unpinned matplotlib dependency permits uncontrolled upgrades to versions not tested by the skill author, which increases supply-chain and stability risk. This is especially relevant for educational tools that may be installed in varied environments without strict dependency governance.

Unpinned Dependencies

Low
Category
Supply Chain
Content
# 可视化
matplotlib>=3.5.0
plotly>=5.0.0

# 符号数学(可选)
sympy>=1.10.0
Confidence
88% confidence
Finding
Specifying plotly with only a minimum version allows arbitrary future versions to be resolved, reducing reproducibility and potentially pulling in vulnerable or incompatible releases. This is a common dependency hygiene weakness rather than evidence of malicious intent.

Unpinned Dependencies

Low
Category
Supply Chain
Content
plotly>=5.0.0

# 符号数学(可选)
sympy>=1.10.0

# 数据处理
pandas>=1.3.0
Confidence
88% confidence
Finding
An unpinned sympy dependency introduces supply-chain uncertainty because installers may resolve to newer versions with unreviewed security or compatibility characteristics. While not immediately exploitable on its own, it weakens dependency integrity controls.

Unpinned Dependencies

Low
Category
Supply Chain
Content
sympy>=1.10.0

# 数据处理
pandas>=1.3.0

# 测试
pytest>=7.0.0
Confidence
88% confidence
Finding
Using pandas with only a minimum version makes builds non-reproducible and can expose users to future vulnerable releases or dependency conflicts. For a skill that likely processes user-provided data, dependency predictability matters for safe deployment.

Unpinned Dependencies

Low
Category
Supply Chain
Content
pandas>=1.3.0

# 测试
pytest>=7.0.0
Confidence
80% confidence
Finding
pytest is listed with only a minimum version, which creates reproducibility and supply-chain risk, though its impact is lower because it is a test dependency rather than core runtime functionality. If test dependencies are installed in production-like environments, they can still expand attack surface.

Static analysis

Detected: suspicious.dynamic_code_execution

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
tools/plot_interactive.py:55