Am I affected?

type your phoenix_storybook version to check

Description

Code Injection vulnerability in phenixdigital phoenix_storybook allows unauthenticated remote code execution via unsanitized attribute value interpolation in HEEx template generation.

The psb-assign WebSocket event handler in 'Elixir.PhoenixStorybook.Story.PlaygroundPreviewLive':handle_event/3 accepts arbitrary attribute names and values from unauthenticated clients. These values are passed to 'Elixir.PhoenixStorybook.Helpers.ExtraAssignsHelpers':handle_set_variation_assign/3, which stores them verbatim. When rendering, 'Elixir.PhoenixStorybook.Rendering.ComponentRenderer':attributes_markup/1 interpolates binary attribute values directly into a HEEx template string as name="<val>" without escaping double quotes or HEEx expression delimiters. An attacker can supply a value containing a closing quote followed by a HEEx expression block (e.g. foo" injected={EXPR} bar="), which causes EXPR to be treated as an inline Elixir expression. The resulting template is compiled via EEx.compile_string/2 and executed via Code.eval_quoted_with_env/3 with full Kernel imports and no sandbox, giving the attacker arbitrary code execution on the server.

This issue affects phoenix_storybook from 0.5.0 before 1.1.0.

Weaknesses & attack patterns

Weakness

CWE-94 · Improper Control of Generation of Code ('Code Injection') in catalog → MITRE ↗

Attack patterns

CAPEC-242 · Code Injection MITRE ↗

Affected — Hex / phoenix_storybook Hex.pm ↗ Repository ↗

0.5.0 < 1.1.0 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:phenixdigital:phoenix_storybook:*:*:*:*:*:*:*:*
modules · source files · routines
modules Elixir.PhoenixStorybook.Rendering.ComponentRenderer · Elixir.PhoenixStorybook.Story.PlaygroundPreviewLive · Elixir.PhoenixStorybook.Helpers.ExtraAssignsHelpers
source files lib/phoenix_storybook/rendering/component_renderer.ex · lib/phoenix_storybook/live/story/playground_preview_live.ex · lib/phoenix_storybook/helpers/extra_assigns_helpers.ex
routines 'Elixir.PhoenixStorybook.Rendering.ComponentRenderer':attributes_markup/1 · 'Elixir.PhoenixStorybook.Story.PlaygroundPreviewLive':handle_event/3 · 'Elixir.PhoenixStorybook.Helpers.ExtraAssignsHelpers':handle_set_variation_assign/3

Affected — GitHub / phenixdigital/phoenix_storybook Repository ↗

e35379d < 56ab846 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:phenixdigital:phoenix_storybook:*:*:*:*:*:*:*:*
modules · source files · routines
modules Elixir.PhoenixStorybook.Rendering.ComponentRenderer · Elixir.PhoenixStorybook.Story.PlaygroundPreviewLive · Elixir.PhoenixStorybook.Helpers.ExtraAssignsHelpers
source files lib/phoenix_storybook/rendering/component_renderer.ex · lib/phoenix_storybook/live/story/playground_preview_live.ex · lib/phoenix_storybook/helpers/extra_assigns_helpers.ex
routines 'Elixir.PhoenixStorybook.Rendering.ComponentRenderer':attributes_markup/1 · 'Elixir.PhoenixStorybook.Story.PlaygroundPreviewLive':handle_event/3 · 'Elixir.PhoenixStorybook.Helpers.ExtraAssignsHelpers':handle_set_variation_assign/3

References

Credits

Nick Mykhailyshyn Finder
Cenk Kücük Analyst
Christian Blavier Remediation developer
Jonatan Männchen / EEF Analyst

CVSS breakdown

CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H
« All CVEs