← Back to list

picoCTF caas (Cowsay as a Service)- Best Writeup

Challenge Name: caas Author: BrownieInMotion Category: Web Exploitation Vulnerability Type: Remote Code Execution (RCE) / Command Injection

xrabbit · 2025-12-30 15:51 · 0 claps · 1.1 min read
#caa #picoctf #medium #remote-code-execution #picoctf-caas
Open on Medium ↗
Wiki topics: LIT · Literature & Writing 🔒 · Cybersecurity 🥊 · Combat Sports

picoCTF caas (Cowsay as a Service)- Best Writeup

Challenge Name: caas Author: BrownieInMotion Category: Web Exploitation Vulnerability Type: Remote Code Execution (RCE) / Command Injection

Challenge Description

The caas challenge presents Cowsay as a Service, where user input is passed to a backend Node.js Express application that executes the cowsay system command and returns the output.

Root Cause of Vulnerability

The application uses the Node.js child_process.exec() function with unsanitized user-controlled input (check the index.js file) :

exec(`/usr/games/cowsay ${req.params.message}`)

Because exec() invokes a system shell, any input provided via req.params.message is interpreted by the shell. This creates a command injection vulnerability, leading directly to Remote Code Execution (RCE).

Impact

  • Execution of arbitrary system commands
  • Reading sensitive files (e.g., flags in CTF environments)
  • Full compromise of the application container.

Now Use “cat” command to view the falg.txt


메타데이터
post_id
86cd6b08adda
slug
picoctf-caas-cowsay-as-a-service-best-writeup-86cd6b08adda
url
https://medium.com/@xrabbit/picoctf-caas-cowsay-as-a-service-best-writeup-86cd6b08adda
canonical_url
https://medium.com/@xrabbit/picoctf-caas-cowsay-as-a-service-best-writeup-86cd6b08adda
author_url
https://medium.com/@xrabbit
status
ok
fetched_at
2026-06-12 22:02:08