Aller au contenu

3v@l

Writeup de Arnold-26, repris avec son autorisation. Source : cylab-academy-writeups — challenge #484, résolu le 2026-11-23. Flags tronqués.

Catégorie : Web Exploitation · Challenge : #484 · Résolu le : 2026-11-23

Énoncé

ABC Bank's website has a loan calculator to help its clients calculate the amount they pay if they take a loan from the bank. Unfortunately, they are using an eval function to calculate the loan. Bypassing this will give you Remote Code Execution (RCE). Can you exploit the bank's calculator and read the flag?

Résolution

Méthode : bypass de blocklist sur eval.

Le calculateur passe l'entrée à eval() avec une blocklist (os, eval, exec, ls, cat, shell, socket...) et une regex qui interdit /, ., les extensions et les escapes. On contourne en concatenant les chaînes ('o'+'s') et en utilisant chr(47) / chr(46) pour / et . : __import__('o'+'s').listdir(chr(47)) révèle /flag.txt, puis open(chr(47)+'flag'+chr(46)+'txt').read() le lit.

Flag

academy{...}