view_component: Reused Component Instances Retain Stale Render Context
view_component is a framework for building reusable, testable, and encapsulated view components in Ruby on Rails. From 4.0.0 until 4.12.0, ViewComponent::Base instances retain render-scoped objects across calls to render_in; if the same component, collection, or spacer component instance is reused across requests, users, tenants, or threads, later renders can use stale helpers, controller, request, view_flow, format/variant details, and slot child context from an earlier render. This can cause authorization-aware components to render privileged UI for a lower-privileged user, generate links using a stale Host header, leak slot/helper state, and mix request context under concurrent rendering. This issue is fixed in version 4.12.0.
Problem Types
| Type | CWE ID | Description |
|---|
| CWE | CWE-362 | CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') |
| CWE | CWE-488 | CWE-488: Exposure of Data Element to Wrong Session |
| CWE | CWE-668 | CWE-668: Exposure of Resource to Wrong Sphere |
Type: CWE
Description: CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
Type: CWE
Description: CWE-488: Exposure of Data Element to Wrong Session
Type: CWE
Description: CWE-668: Exposure of Resource to Wrong Sphere
Metrics
| Version | Base score | Base severity | Vector |
|---|
| 3.1 | 6.8 | MEDIUM | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N |
Version: 3.1
Base score: 6.8
Base severity: MEDIUM
Vector: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N