rusty_vault - DownUnderCTF 2024
rustで書かれたcrackme
入力した文字列を暗号化して、その結果が定数と等しければよい
暗号化につかうパラメータはすべてバイナリにあるので、復号してやればよい
code: solve.rs
use aead::{Aead, KeyInit};
use aes_gcm::{Aes256Gcm, Nonce};
fn main() {
let key = [
0x95, 0x87, 0xe8, 0xe7, 0xde, 0xc0, 0x3c, 0x28, 0xa2, 0x8c, 0xa1, 0xf7, 0x35, 0x27, 0x23,
0x81, 0x6c, 0x21, 0x6e, 0x10, 0x71, 0x4a, 0x62, 0x0b, 0x9e, 0x36, 0x78, 0x93, 0x38, 0x96,
0x90, 0xcf,
];
let nonce = [
0xff, 0x06, 0x72, 0x45, 0xc6, 0xae, 0x7b, 0x9f, 0xc1, 0x36, 0xd4, 0x8e,
];
0xfa, 0xa6, 0x56, 0x32, 0xc3, 0x71, 0x30, 0xcd, 0x29, 0x16, 0x16, 0x0f, 0x39, 0x4f, 0xe7,
0x65, 0x2e, 0xfa, 0x05, 0xdb, 0xcc, 0xea, 0x47, 0x12, 0xc8, 0xf4, 0x7f, 0xed, 0x90, 0x30,
0xf6, 0xad, 0xab, 0xb1, 0x50, 0xa7, 0xa2, 0xcf, 0xb5, 0xd1, 0x3b, 0x2e, 0xb3, 0x9a, 0xfe,
0x36, 0xa0, 0x8e, 0x90, 0x18, 0x9f, 0x04, 0xe7, 0xcb, 0x79, 0x61, 0x5c, 0xd9, 0x5b, 0x38,
];
let key = Aes256Gcm::new_from_slice(&key).unwrap();
let nonce = Nonce::from_slice(&nonce);
let text = key.decrypt(nonce, ciphertext.as_ref()).unwrap();
let text = String::from_utf8_lossy(&text);
println!("{text}");
}