Hanto Dojo

Server Side Template Injection

A collection of challenges about server side template injection, using Flask servers and Jinja2 templates.

9 challenges

Challenges

CHALLENGE 01

Out of Context

— solves

I decided to make an online calculator, using the power of Flask!

Due to lingering trauma from the Python jails, I will no longer be using eval.

I heard somewhere that I can safely evaluate short expressions by rendering a template?

Of course, I will continue to share the length of the flag throughout our adventures!

CHALLENGE 02

I Dropped My Keys

— solves

Lesson learned: context is dangerous!

Anyway, I am not a big fan of randomness.

I'll just set the secret key to the flag instead of random bytes.

Secret keys are secret, right?

CHALLENGE 03

I Dropped My Cookie

— solves

Well, that was a mistake. Back to os.urandom!

On another note, I decided to create a login system to secure the flag more safely.

Passwords are so long these days though, so I'll just check the first few characters.

Last time I checked, Flask cookies are encrypted by default.

CHALLENGE 04

Crack the Cookie

— solves

More lessons learned: keep cookies as slim as possible, and don't be lazy when checking passwords.

This time, I will show you your password once you're logged in.

Common sense says that you can't login as admin if you don't know the admin password. Do you agree?

CHALLENGE 05

Long Island Expressway

— solves

No more users. Back to basics. Now supporting longer expressions!

CHALLENGE 06

Flotation Devices Are Banned, Period

— solves

Integers only.

CHALLENGE 07

Be There or Be Square

— solves

In this house, we prefer parentheses over square brackets. Also, death to underscores!

CHALLENGE 08

No More Templates?

— solves

My faith in template rendering to safely evaluate expressions has been forever shattered.

I'll just do it myself then. Back to eval I go!

CHALLENGE 09

Spill the Tea

— solves

This calculator is powered by coffee.