← Blog

MCP server CSS clip-path consent security

Four SA-CSS-CPT consent attack patterns using clip-path to clip the paint area of consent text to zero while preserving the element's layout box and interactivity. A zero-height polygon defined by four vertices with equal top and bottom y-coordinates produces an empty clip region. circle(0 at 50% 50%) clips to a zero-radius circle, rendering nothing. inset(50% 0 50% 0) clips the top 50% and bottom 50% simultaneously, consuming the full height. An animated clip-path times the zero-clip state to the moment the dialog opens, so consent text is invisible during the interaction window. All four patterns preserve the element's layout dimensions, DOM presence, and click-target area.

By SkillAudit  |  29 Oct 2026

The CSS clip-path property restricts the paint area of an element to a geometric shape. Pixels outside the clip region are not rendered, but the element's layout box — including its width, height, margin, and click/touch target area — is unaffected. This distinction is critical for consent attacks: a consent text element with a zero-area clip path occupies its full original space in the layout, meaning the "Allow" button positioned relative to it stays in the expected position. The user can click "Allow" at the familiar location while the consent text describing what they are agreeing to is entirely invisible. Standard WCAG color contrast tools do not parse clip-path geometry; they see the element as present in the DOM with a valid color and report it as accessible.

SA-CSS-CPT-001: clip-path:polygon(0 0, 100% 0, 100% 0%, 0 0%) — zero-height clip

A CSS polygon clip region is defined by a list of vertex coordinates. This attack defines four vertices where the top edge and bottom edge of the polygon share the same y-coordinate — zero. The clip region has 100% width but 0% height. No pixels fall inside this zero-height rectangle; the entire element paint area is clipped away. The polygon is syntactically valid and geometrically non-degenerate (it has four distinct x-coordinates), which may allow it to pass naive clip-path validation checks that only verify vertex count or syntax.

.consent-text {
  color: #111111;
  /* Zero-height polygon: top y = 0, bottom y = 0% (= 0px) */
  clip-path: polygon(0 0, 100% 0, 100% 0%, 0 0%);
}

/* Clip region geometry analysis:
   Vertex list: (x, y) in element-local coordinates
   V1: (0,    0  ) — top-left corner
   V2: (100%, 0  ) — top-right corner
   V3: (100%, 0% ) — bottom-right: 0% of element height = 0px
   V4: (0,    0% ) — bottom-left:  0% of element height = 0px

   V1.y = 0 (absolute) = 0px
   V3.y = 0% = 0 * element_height = 0px
   V4.y = 0% = 0px

   Height of clip region: max(y) - min(y) = 0px - 0px = 0px
   Width of clip region: 100% (full element width)

   Area = width * height = full_width * 0px = 0 square pixels
   No pixels fall inside the clip region.
   Element renders as completely invisible — zero painted pixels.

   Layout box: unaffected. clip-path does not change:
   - offsetWidth, offsetHeight (reported as original dimensions)
   - getBoundingClientRect() (returns original full bounding box)
   - Pointer events: the element still receives click/touch at its layout position
   - Accessibility tree: element still present; screen readers read text content

   DOM visibility: element.offsetParent is non-null (not display:none)
   Computed visibility: getComputedStyle(el).visibility === "visible"
   Computed display: getComputedStyle(el).display !== "none"
   Contrast checker: computes color #111111 on white background → reports 19.6:1

   CSSOM detection:
   getComputedStyle(el).clipPath → "polygon(0px 0px, 100% 0px, 100% 0px, 0px 0px)"
   (browsers may normalize 0% to 0px in computed value)

   Detection algorithm:
   1. Read getComputedStyle(el).clipPath.
   2. Parse polygon vertex list; extract all y-coordinates.
   3. Resolve percentage y-values using element offsetHeight.
   4. Compute clip region bounding box: (max_x - min_x) * (max_y - min_y).
   5. If clip area == 0 (or < 1px²) → CRITICAL.
   6. Also check: if all y-coordinates equal the same value → zero-height → CRITICAL. */

Layout box preserved: Unlike visibility:hidden or display:none, a zero-area clip-path leaves the element's layout dimensions fully intact. The element takes up space, the "Allow" button remains in position, and the element receives pointer events. A user who clicks where they expect the "Allow" button to be based on prior experience will activate consent without ever seeing the clipped consent text.

CRITICAL
SA-CSS-CPT-001 — clip-path:polygon(0 0, 100% 0, 100% 0%, 0 0%): zero-height polygon clips entire paint area; element invisible; layout box preserved; pointer events intact. WCAG checker reports 19.6:1 contrast. Detection: parse polygon y-coordinates; if clip area = 0px² → CRITICAL.

SA-CSS-CPT-002: clip-path:circle(0 at 50% 50%) — zero-radius circle

The circle() basic shape defines a circular clip region by radius and center coordinates. Setting the radius to zero produces a point-size circle with zero area — no pixels fall inside it. This is the most concise clip-path attack: the declaration is short, looks like it might be a valid "highlight" or "reveal" animation start state, and is not easily distinguished from intentional use without resolving the radius value against the element dimensions.

.consent-text {
  color: #111111;
  clip-path: circle(0 at 50% 50%);   /* radius = 0; center = element center */
}

/* Circle clip region geometry:
   clip-path: circle(r at cx cy)
   r  = 0 (zero radius)
   cx = 50% = 0.5 * element_width  (horizontal center)
   cy = 50% = 0.5 * element_height (vertical center)

   Area of circle: π * r² = π * 0² = 0 square pixels.
   Zero-area circle: no pixel has distance < 0 from center.
   Every pixel of the element is clipped away.

   Variant: clip-path: circle(0px at 50% 50%)
   Identical result — explicit unit (0px) rather than unitless (0).
   Both computed styles normalize to: "circle(0px at 50% 50%)" in most browsers.

   Variant: clip-path: circle(0 at center)
   "at center" expands to "at 50% 50%" — same zero-area clip.

   Layout / accessibility behavior:
   Same as polygon(0 0,...) — layout box preserved, pointer events intact.
   getComputedStyle(el).clipPath → "circle(0px at 50% 50%)"

   Circle(0) as legitimate animation start state:
   In CSS reveal animations: @keyframes reveal { from { clip-path: circle(0 at 50% 50%) }
                                                  to   { clip-path: circle(100% at 50% 50%) } }
   A static circle(0) without an animation appears to be an incomplete or paused animation.
   This provides plausible deniability: "the animation just didn't start."

   Detection:
   Parse getComputedStyle(el).clipPath for circle() function.
   Extract radius value (first argument). Resolve units against element dimensions.
   If computed radius <= 1px → clip area ≤ π*1² ≈ 3px² → effectively zero → CRITICAL.
   Check for associated animation that would eventually expand the radius.
   If no animation or animation paused indefinitely: static zero clip → CRITICAL. */

Plausible deniability via animation: circle(0 at 50% 50%) is the standard starting keyframe for a "radial reveal" animation. A malicious MCP server can include a @keyframes rule that expands the circle to full size after 30 seconds, or that triggers on a custom JavaScript event that never fires. Auditors must check not just the current computed clip-path value but also whether any animation would change it within a reasonable interaction timeframe.

CRITICAL
SA-CSS-CPT-002 — clip-path:circle(0 at 50% 50%): zero-radius circle clips entire paint area; element invisible; layout box intact. May masquerade as animation start state. Detection: parse circle radius; if ≤1px and no completing animation within consent window → CRITICAL.

SA-CSS-CPT-003: clip-path:inset(50% 0 50% 0) — overlapping insets consume full height

The inset() basic shape defines a rectangular clip region by inset distances from each edge of the element's border box. The four arguments are top, right, bottom, left insets. When top and bottom insets sum to 100% or more of the element height, the clip rectangle has zero or negative height and nothing is rendered. inset(50% 0 50% 0) insets 50% from the top and 50% from the bottom simultaneously, leaving a zero-height clip region at exactly the midpoint of the element. This is harder to flag on cursory inspection because 50% looks like a sensible layout value rather than an obviously zero-area clip.

.consent-text {
  color: #111111;
  clip-path: inset(50% 0 50% 0);   /* inset 50% top + 50% bottom = 100% consumed */
}

/* Inset clip region geometry:
   clip-path: inset(top right bottom left)
   top    = 50% of element height
   right  = 0
   bottom = 50% of element height
   left   = 0

   For element with height H:
   Clip rectangle top edge:    0 + 50%*H = 0.5H  (from top of element)
   Clip rectangle bottom edge: H - 50%*H = 0.5H  (from top of element)

   Clip height: bottom_edge - top_edge = 0.5H - 0.5H = 0
   Clip width:  element_width - 0 - 0 = full width (right=0, left=0)

   Clip area: full_width * 0 = 0 square pixels → nothing rendered.

   With a rounded inset: inset(50% 0 50% 0 round 8px)
   The round parameter adds border-radius to the clip rectangle.
   But since height = 0, rounding does not produce any visible area.
   The computed clip-path string includes "round 8px" — looks like a styled card clip.

   Variant analysis:
   inset(0 50% 0 50%)  — clips 50% left + 50% right = zero width → invisible
   inset(25% 0 75% 0)  — top inset 25% + bottom inset 75% = 100% height → invisible
   inset(40% 0 60% 0)  — 40%+60% = 100% → invisible
   inset(49% 0 51% 0)  — 49%+51% = 100% → invisible
   inset(51% 0 49% 0)  — 51%+49% = 100% → invisible (negative height clamped to 0)

   CSS spec: if inset values sum > 100%, the resulting rectangle has negative dimensions,
   which are treated as 0 (the clip region collapses, not extends).
   inset(60% 0 60% 0) — sum = 120% > 100%; clamped to 0-height → invisible.

   CSSOM detection:
   getComputedStyle(el).clipPath → "inset(50% 0px 50% 0px)" (normalized)

   Detection algorithm:
   1. Parse inset() arguments: top, right, bottom, left.
   2. Resolve percentage values against element offsetHeight and offsetWidth.
   3. Compute clip height: max(0, element_height - top_px - bottom_px).
   4. Compute clip width: max(0, element_width - right_px - left_px).
   5. If clip height == 0 OR clip width == 0 → CRITICAL. */

Why 50%+50% looks legitimate: Designers sometimes use clip-path:inset() for clipping effects on decorative elements. A value of inset(50%) (all four sides at 50%) looks superficially like a "collapse to center" animation target. Auditors must resolve percentage values to pixel dimensions and verify the resulting clip area is non-zero to distinguish real from zero-area clips.

CRITICAL
SA-CSS-CPT-003 — clip-path:inset(50% 0 50% 0): top 50% + bottom 50% = 100% height consumed; zero clip height; element invisible; layout box intact. Variant inset(0 50% 0 50%) clips horizontally. Detection: resolve inset px values; if clip height or width = 0 → CRITICAL.

SA-CSS-CPT-004: animated clip-path — consent text hidden during interaction window

An animated clip-path can be timed so that the consent text element is clipped to zero at the moment the dialog opens, and only expands to full visibility after a delay that exceeds the typical user interaction time. Because CSS animations begin immediately on element insertion (or on page load), the animation start state can be precisely synchronized to the dialog appearance. With animation-fill-mode:forwards, the element freezes at the last keyframe after the animation completes, so an auditor inspecting the page after the animation finishes will see the text as visible and passing contrast checks — the attack window has already closed.

.consent-text {
  color: #111111;
  animation: clip-attack 2s ease forwards;
}

@keyframes clip-attack {
  0%   { clip-path: inset(50% 0 50% 0); }   /* fully clipped at dialog open */
  100% { clip-path: inset(0% 0 0% 0);   }   /* fully visible after 2 seconds */
}

/* Animation timeline analysis:
   t=0s (dialog opens):    clip-path: inset(50% 0 50% 0) → invisible (0px clip height)
   t=0.5s:                 clip-path: inset(37.5% 0 37.5% 0) → 25% height visible
   t=1.0s (ease midpoint): clip-path: inset(~30% 0 ~30% 0) → ~40% height visible
   t=2.0s:                 clip-path: inset(0% 0 0% 0)   → 100% height visible
   t>2.0s (forwards):      clip-path: inset(0% 0 0% 0)   → frozen visible (fill-mode)

   Attack window: t=0 to approximately t=1.5s.
   Typical user interaction: sees dialog, reads, clicks "Allow" within 1–3 seconds.
   During the critical 0–1.5s window: consent text is partially or fully clipped.
   User clicks "Allow" at ~t=0.5s based on familiar dialog layout → consent text invisible.

   fill-mode:forwards freezes at 100% keyframe (fully visible).
   Post-animation static audit sees fully visible text → passes contrast check.
   Temporal attack: only detectable by checking animation state at t=0 or during animation.

   Reverse variant (starts visible, briefly clips, returns visible):
   @keyframes clip-blink {
     0%   { clip-path: inset(0%);  }   /* visible at load (dialog animation in) */
     10%  { clip-path: inset(50%); }   /* clips to invisible at t=0.2s into interaction */
     30%  { clip-path: inset(50%); }   /* invisible through t=0.6s */
     100% { clip-path: inset(0%);  }   /* returns visible */
   }
   animation: clip-blink 2s 0s both;
   The clip-blink variant hides text at the precise moment the user's eyes move to the
   "Allow" button area, then restores it. Visually the text appears to have always been present.

   CSSOM detection at page-load:
   getComputedStyle(el).clipPath → returns CURRENT animated value (may be mid-animation)
   getComputedStyle(el).animationName → "clip-attack" (detectable)
   getComputedStyle(el).animationDuration → "2s"

   Detection algorithm:
   1. Check animationName; if present, locate @keyframes rule by name.
   2. Parse 0% keyframe clip-path value.
   3. Resolve clip area at 0% keyframe: if clip area == 0 → consent hidden at dialog open.
   4. Check animationDelay: if delay == 0s and duration <= 5s, consent text hidden on load.
   5. CRITICAL: animated clip with 0% keyframe = zero area AND no meaningful delay.
   6. Also check: element.getAnimations() in live DOM for real-time animation state. */

Static audit misses temporal attacks: An auditor that reads the computed style once after the page has loaded may see clip-path: inset(0%) (the post-animation frozen state) and report the element as fully visible. Temporal clip-path attacks require either: (a) reading the 0%-keyframe value from the animation definition, (b) checking element.getAnimations()[0].effect.getKeyframes() in a live browser context, or (c) capturing the element state immediately at dialog insertion time.

CRITICAL
SA-CSS-CPT-004 — animated clip-path: inset(50%) at 0% keyframe → consent text clipped to zero at dialog open; expands to visible after 2s (post-interaction); fill-mode:forwards freezes at visible; post-animation static audit passes. Detection: inspect 0% keyframe clip value; if zero-area at start with no delay → CRITICAL.

Summary of SA-CSS-CPT findings

IDSeverityPatternMechanismWCAG impact
SA-CSS-CPT-001 CRITICAL clip-path:polygon(0 0, 100% 0, 100% 0%, 0 0%) Four-vertex polygon with zero height; no pixel inside clip region; layout box intact Element invisible; layout/clicks preserved
SA-CSS-CPT-002 CRITICAL clip-path:circle(0 at 50% 50%) Zero-radius circle; area = 0; may masquerade as animation start state Element invisible; layout/clicks preserved
SA-CSS-CPT-003 CRITICAL clip-path:inset(50% 0 50% 0) Top+bottom insets sum to 100% height; zero clip height; looks like a valid layout value Element invisible; layout/clicks preserved
SA-CSS-CPT-004 CRITICAL animated clip-path 0% keyframe = zero Consent text clipped during interaction window; expands post-interaction; static audit passes Invisible during t=0–1.5s; temporal attack

Related pages