Back to skill

Security audit

Webperf Interaction

Security checks for vulnerabilities and agentic risk

Overview

This is a web performance diagnostic skill, but it deserves review because it can chain DevTools page scripts and one scroll audit changes a page-wide browser API until the page is reloaded.

Use this skill mainly on pages you own or are comfortable inspecting through DevTools. Confirm before letting an agent run chained follow-up snippets, avoid sensitive logged-in pages unless necessary, and reload the page after Scroll-Performance.js to remove its page-level instrumentation. Treat LoAF helper exports as local performance data that may include script URLs and function names.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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)

T07 · Tool Hijacking and Spoofing

Warning
Location
scripts/Scroll-Performance.js:2
Finding
Persistent Global Wrapping of EventTarget.addEventListener<![CDATA[ ## Vulnerability Details **File Location**: `scripts/Scroll-Performance.js:2` **Vulnerability Type**: Global browser API modification without restoration **Risk Level**: Medium ### Vulnerable Code ```js const n = EventTarget.prototype.addEventListener; EventTarget.prototype.addEventListener = function (l, s, o) { return ( t.has(l) && ( !0 !== o && "object" == typeof o && null !== o && !0 === o.passive || e.push({ type: l, element: this.tagName || this.constructor?.name || "unknown", id: this.id || "", passive: !1 }) ), n.call(this, l, s, o) ); }; ``` ### Technical Analysis The script replaces `EventTarget.prototype.addEventListener` for the entire inspected page. The wrapper records metadata about future `scroll`, `wheel`, and touch-event listener registrations before forwarding each call to the previously captured implementation. The modification is not isolated to the audit code. Every subsequent event-listener registration made by application code, frameworks, browser extensions operating in the same JavaScript world, or other diagnostic snippets passes through this wrapper. No cleanup mechanism restores the original method. Re-executing the script captures the existing wrapper as the new delegate and installs another wrapper around it. This can create a chain of persistent wrappers, retain multiple instrumentation closures, duplicate collected observations, and alter the observable identity of the native method. It may also conflict with application or monitoring code that expects the original API or independently instruments it. The reviewed implementation continues to call the original method and does not capture callback contents, transmit information, or intentionally execute malicious logic. The risk is therefore limited to page integrity, compatibility, measurement accuracy, and runtime stability rather than credenti ...[truncated 1653 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Make installation idempotent.** Store instrumentation state under a private `Symbol` or uniquely named property and refuse to install another wrapper when one is already active. 2. **Preserve the actual original method.** Record the native implementation once rather than treating a previously installed wrapper as the original method. 3. **Provide explicit cleanup.** Expose a cleanup function that: - Restores `EventTarget.prototype.addEventListener`. - Removes the installed scroll listener. - Cancels active animation frames. - Clears pending timers. - Releases collected state where appropriate. 4. **Use `try/finally` for bounded audits.** If listener inspection only needs to occur during a defined measurement period, restore the API in a `finally` block after collection. 5. **Avoid prototype modification where possible.** Prefer Chrome DevTools Protocol facilities or other diagnostic mechanisms that inspect listeners without changing page-wide native APIs. 6. **Document side effects.** Clearly warn that the snippet instruments a global browser API and specify the cleanup procedure. A hardened installation pattern should resemble: ```js const STATE = Symbol.for("webperf.scrollPerformance"); const prototype = EventTarget.prototype; if (!prototype[STATE]) { const originalAddEventListener = prototype.addEventListener; const wrappedAddEventListener = function (type, listener, options) { // Collect only the minimum required metadata. return Reflect.apply(originalAddEventListener, this, [ type, listener, options ]); }; prototype[STATE] = { originalAddEventListener, wrappedAddEventListener }; prototype.addEventListener = wrappedAddEventListener; } window.cleanupScrollPerformanceAudit = () => { const state = prototype[STATE]; if (state && prototype.addEventListener === state.wrappedAddEventListener) { prototype.addEventListener = state.originalAddEv ...[truncated 135 chars]
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (13)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The code does relate to interaction performance and INP-style analysis, so the high-level domain is aligned. However, the declared description substantially overstates the implemented functionality. The supplied code only sets up a PerformanceObserver for event timing entries, groups entries by interactionId, reports duration and latency sub-parts, gives generic recommendations, and provides a basic aggregate summary. It does not implement the described automated workflows, decision trees, script attribution, scroll-jank analysis, third-party analysis, CLS correlation, animation debugging, or any explicit Chrome DevTools MCP integration. Because the declared purpose claims multiple concrete analysis capabilities that are absent from the code, this is a material description-behavior mismatch.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The supplied code is narrowly focused on layout shift monitoring. It registers a PerformanceObserver for 'layout-shift', aggregates shift values excluding recent input for CLS, tracks affected elements/selectors, and returns a summary labeled with metric 'CLS'. There is no code for interaction latency/INP measurement, event timing phase analysis, long frames, script attribution, main-thread task analysis, scroll performance, third-party impact, animation debugging, or cross-skill workflow orchestration. While the description mentions correlating layout shifts with interactions/loading as part of a broader intelligent interaction analysis tool, this chunk implements only the layout-shift/CLS portion, making the declared purpose materially broader and different from the actual behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding
The description presents a comprehensive interaction-audit skill with automated debugging workflows for INP, scroll jank, main-thread blocking, layout-shift correlation, and cross-skill integrations. The supplied code is much more limited: it only collects and reports long animation frame entries using the browser PerformanceObserver long-animation-frame entry type, exposes helper methods on window.loafHelpers, and supports exporting the gathered data. Script attribution is present in a limited sense because it records per-frame script information and can rank top scripts, which partially aligns with the declared mention of script attribution when long frames are detected. However, most of the declared higher-level capabilities are absent from this code chunk, and the export/download behavior is not mentioned in the description. Therefore the description does not accurately represent what this specific code chunk actually does.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding
The code is focused specifically on scroll performance diagnostics. It monkey-patches addEventListener to record non-passive scroll/wheel/touch listeners, monitors frame intervals during scrolling, counts dropped frames, audits CSS properties like scroll-behavior, will-change, content-visibility, and overscroll-behavior, and returns a summary object. While this partially aligns with the declared mention of scroll jank investigation, the declared description presents a much broader and more automated interaction-performance analysis system centered on INP, script attribution, interaction audits, layout shift correlation, third-party analysis, and cross-skill integrations. Those capabilities are not present in the supplied code chunk, making the description materially broader than the actual behavior.

Ae1

High
Category
analysis-evasion
Content
- `scripts/Interactions.js` — Interactions
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- `scripts/Layout-Shift-Loading-and-Interaction.js` — Layout Shift Tracking
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- `scripts/Long-Animation-Frames-Helpers.js` — LoAF Helpers
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- `scripts/Long-Animation-Frames.js` — Long Animation Frames (LoAF)
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- `scripts/LongTask.js` — Long Tasks
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
---
name: webperf-interaction
description: Intelligent interaction performance analysis with automated workflows for INP debugging, scroll jank investigation, and main thread blocking. Includes decision trees that automatically run script attribution when long frames detected, break down input latency phases, and correlate layout shifts with interactions. Features workflows for complete interaction audit, third-party script impact analysis, and animation performance debugging. Cross-skill integration with Core Web Vitals (INP/CLS correlation) and Loading (script execution analysis). Use when the user asks about slow interactions, janky scrolling, unresponsive pages, or INP optimization. Compatible with Chrome DevTools MCP.
license: MIT
metadata:
  author: Joan Leon | @nucliweb
Confidence
89% confidence
Finding
The metadata promotes 'automated workflows' that automatically run additional analysis, encouraging autonomous action in a sensitive browser context. In this skill context, autonomy is more dangerous because DevTools script evaluation can inspect live page state and potentially touch authenticated sessions or user content.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill instructs operators to execute DevTools evaluation scripts against the active browser context without warning that page data may be inspected. In a browser-attached environment, this can lead to unintended access to sensitive DOM, interaction, and application state data, especially if the user did not expect page inspection to occur automatically.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
## Decision Tree

Use this decision tree to automatically run follow-up snippets based on results:

### After Interactions.js
Confidence
94% confidence
Finding
The explicit decision tree to 'automatically run follow-up snippets' is a true autonomy concern because it delegates multi-step inspection decisions to the agent. In a Chrome DevTools MCP environment, that increases the chance of unbounded analysis of the active application without transparent user awareness.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The decision tree repeatedly tells the agent to automatically run follow-up snippets based on observed results, which expands page inspection without renewed user approval. This is dangerous because each follow-up script may read more data from the active page than the user intended when asking an initial performance question.

Static analysis

No suspicious patterns detected.