https://app.hackthebox.com/challenges/672

Description

It’s a known secret that each faction speaks different languages, however few can speak all of them. KORP has long wanted to send a spy in the factions to keep an eye on them. Through their extensive network, they have found different talented factionless to test. The first to show their multidigilingual skills will get a place in them, and be their secret agent amongst the factions. Can you show them your worth?

Exploitation

Polyglots

#if 0
#<?php system('cat flag.txt;'); __halt_compiler();?>
print((("b" + "0" == 0 and exec("cat flag.txt")) or (0 and exec("cat flag.txt") or eval('__import__("sys").stdout.write(open("flag.txt").read())'))));
#endif
__asm__(".section .text\n.globl main\nmain:\nmov $0x0000000000000000, %rax\npush %rax\nmov $0x7478742e67616c66, %rax\npush %rax\nmov %rsp, %rdi\nxor %rsi, %rsi\nmov $2, %rax\nsyscall\nmov %rax, %rdi\nmov %rsp, %rsi\nmov $0x100, %rdx\nxor %rax, %rax\nsyscall\nmov $1, %rdi\nmov %rsp, %rsi\nmov %rax, %rdx\nmov $1, %rax\nsyscall\nxor %rdi, %rdi\nmov $60, %rax\nsyscall\n");

CyberChef

I2lmIDAKPD9waHAgc3lzdGVtKCdjYXQgZmxhZy50eHQ7Jyk7IF9faGFsdF9jb21waWxlcigpOz8+CnByaW50KCgoImIiICsgIjAiID09IDAgYW5kIGV4ZWMoImNhdCBmbGFnLnR4dCIpKSBvciAoMCBhbmQgZXhlYygiY2F0IGZsYWcudHh0Iikgb3IKZXZhbCgnX19pbXBvcnRfXygic3lzIikuc3Rkb3V0LndyaXRlKG9wZW4oImZsYWcudHh0IikucmVhZCgpKScpKSkpOwojZW5kaWYKX19hc21fXygiLnNlY3Rpb24gLnRleHRcbi5nbG9ibCBtYWluXG5tYWluOlxubW92ICQweDAwMDAwMDAwMDAwMDAwMDAsICVyYXhcbnB1c2ggJXJheFxubW92CiQweDc0Nzg3NDJlNjc2MTZjNjYsICVyYXhcbnB1c2ggJXJheFxubW92ICVyc3AsICVyZGlcbnhvciAlcnNpLCAlcnNpXG5tb3YgJDIsCiVyYXhcbnN5c2NhbGxcbm1vdiAlcmF4LCAlcmRpXG5tb3YgJXJzcCwgJXJzaVxubW92ICQweDEwMCwgJXJkeFxueG9yICVyYXgsICVyYXhcbnN5c2NhbGxcbm1vdgokMSwgJXJkaVxubW92ICVyc3AsICVyc2lcbm1vdiAlcmF4LCAlcmR4XG5tb3YgJDEsICVyYXhcbnN5c2NhbGxcbnhvciAlcmRpLCAlcmRpXG5tb3YgJDYwLAolcmF4XG5zeXNjYWxsXG4iKTs

Summary

MultiDigilingual: reduce the custom rules to a scriptable check and use the smallest reliable path to the flag.