|
1 | | -# sv |
| 1 | +# React2Shell (CVE-2025-55182) Visualization |
2 | 2 |
|
3 | | -Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli). |
| 3 | +An interactive educational visualization explaining the React2Shell vulnerability - a critical CVSS 10.0 remote code execution flaw in React Server Components. |
4 | 4 |
|
5 | | -## Creating a project |
| 5 | +## What This Is |
6 | 6 |
|
7 | | -If you're seeing this, you've probably already done this step. Congrats! |
| 7 | +A 5-step narrated walkthrough that explains: |
8 | 8 |
|
9 | | -```sh |
10 | | -# create a new project in the current directory |
11 | | -npx sv create |
| 9 | +1. **Traditional SSR** - How server-side rendering works and the "JSON bottleneck" problem |
| 10 | +2. **RSC Streaming** - How React Server Components solve this with streaming |
| 11 | +3. **The Exploit** - How prototype pollution + gadget chains enable RCE |
| 12 | +4. **The Fix** - The one-line `hasOwnProperty` check that prevents the attack |
| 13 | +5. **Key Takeaways** - Lessons learned for secure architecture |
12 | 14 |
|
13 | | -# create a new project in my-app |
14 | | -npx sv create my-app |
15 | | -``` |
| 15 | +Each step features: |
| 16 | +- Synced audio narration (~5.5 minutes total) |
| 17 | +- Keyframe-driven animations timed to the narration |
| 18 | +- Video player controls (play/pause, seek, speed, captions) |
| 19 | +- Visual highlighting of key concepts |
16 | 20 |
|
17 | | -## Developing |
| 21 | +## Tech Stack |
18 | 22 |
|
19 | | -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: |
| 23 | +- **SvelteKit** with Svelte 5 runes |
| 24 | +- **ElevenLabs** for AI voice generation |
| 25 | +- **OpenAI Whisper** for audio transcription & timestamp extraction |
| 26 | +- **TypeScript** throughout |
| 27 | + |
| 28 | +## Development |
20 | 29 |
|
21 | 30 | ```sh |
| 31 | +npm install |
22 | 32 | npm run dev |
| 33 | +``` |
| 34 | + |
| 35 | +## Changing the Voice / Narration |
| 36 | + |
| 37 | +The narration system is designed to be easily swappable: |
| 38 | + |
| 39 | +### 1. Edit the script |
| 40 | +Scripts are in `scripts/`: |
| 41 | +- `ssr-narration.txt` |
| 42 | +- `rsc-narration.txt` |
| 43 | +- `exploit-narration.txt` |
| 44 | +- `fix-narration.txt` |
| 45 | +- `lessons-narration.txt` |
| 46 | + |
| 47 | +Use ElevenLabs audio tags like `[pause]`, `[short pause]`, `[long pause]` for timing. |
23 | 48 |
|
24 | | -# or start the server and open the app in a new browser tab |
25 | | -npm run dev -- --open |
| 49 | +### 2. Generate audio with ElevenLabs |
| 50 | +Upload the script to ElevenLabs and download the MP3. |
| 51 | + |
| 52 | +### 3. Place the audio file |
| 53 | +Drop the MP3 in `static/audio/` with the matching name (e.g., `ssr-narration.mp3`). |
| 54 | + |
| 55 | +### 4. Transcribe with Whisper |
| 56 | +```sh |
| 57 | +python scripts/transcribe.py ssr |
| 58 | +python scripts/transcribe.py rsc |
| 59 | +python scripts/transcribe.py exploit |
| 60 | +python scripts/transcribe.py fix |
| 61 | +python scripts/transcribe.py lessons |
26 | 62 | ``` |
27 | 63 |
|
28 | | -## Building |
| 64 | +Options: |
| 65 | +- `--model small` - Use a larger Whisper model for better accuracy |
| 66 | +- Custom audio path: `python scripts/transcribe.py ssr ~/Downloads/new-voice.mp3` |
| 67 | + |
| 68 | +The script outputs JSON to `src/lib/data/` with word-level timestamps that drive the animations. |
29 | 69 |
|
30 | | -To create a production version of your app: |
| 70 | +## How the Animation System Works |
| 71 | + |
| 72 | +1. **Whisper JSON** contains word-level timestamps |
| 73 | +2. **Trigger extraction** (`src/lib/utils/whisper-parser.ts`) finds key phrases and returns their timestamps |
| 74 | +3. **Keyframes** map timestamps to animation states |
| 75 | +4. **Timeline controller** (`src/lib/stores/timeline.svelte.ts`) syncs audio playback with animation state |
| 76 | +5. **Components** derive their visual state from `currentTime` using `getAnimationState()` |
| 77 | + |
| 78 | +## Building for Production |
31 | 79 |
|
32 | 80 | ```sh |
33 | 81 | npm run build |
| 82 | +npm run preview |
34 | 83 | ``` |
35 | 84 |
|
36 | | -You can preview the production build with `npm run preview`. |
| 85 | +## Resources |
| 86 | + |
| 87 | +- [react2shell.com](https://react2shell.com/) - Original disclosure |
| 88 | +- [Wiz Deep Dive](https://www.wiz.io/blog/nextjs-cve-2025-55182-react2shell-deep-dive) |
| 89 | +- [Datadog Security Labs](https://securitylabs.datadoghq.com/articles/cve-2025-55182-react2shell-remote-code-execution-react-server-components/) |
| 90 | + |
| 91 | +## License |
37 | 92 |
|
38 | | -> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment. |
| 93 | +Educational purposes. Created for security awareness. |
0 commit comments