BUUCTF_Crypto_WriteUp | old-fashion

发布时间 2023-11-07 13:50:38作者: Guanz

题目

Os drnuzearyuwn, y jtkjzoztzoes douwlr oj y ilzwex eq lsdexosa kn pwodw tsozj eq ufyoszlbz yrl rlufydlx pozw douwlrzlbz, ydderxosa ze y rlatfyr jnjzli; mjy gfbmw vla xy wbfnsy symmyew (mjy vrwm qrvvrf), hlbew rd symmyew, mebhsymw rd symmyew, vbomgeyw rd mjy lxrzy, lfk wr dremj. Mjy eyqybzye kyqbhjyew mjy myom xa hyedrevbfn lf bfzyewy wgxwmbmgmbrf. Wr mjy dsln bw f1_2jyf-k3_jg1-vb-vl_l

分析

标题 old-fashion 翻译为“旧的,不时髦的”,推测该题使用的是一种旧的加密方式。题目的字母分布很像英文语段,但两个分隔符之间的字母又无法组成单词,猜测为单表代换或多表代换。

题目的最后部分“f1_2jyf-k3_jg1-vb-vl_l”包含“-”和"_",猜测很可能是我们需要的 flag 部分,那么前面的“mjy”可能为“the”、“dsln”可能为“flag”、“bw”可能为“is”,对段中六个字母同时进行替换后如下:
Ol frguzeareusg, e htkhzoztzoel fousar oh e iazsex eq alfexola kg psofs tlozh eq ufeolzaiz era raufefax pozs fousarzaiz, efferxola ze e raatfer hghzai; the gfits vaa xe sifgle lettees (the vrst qrvvrf), haies rf lettees, teihlets rf lettees, viotgees rf the axrze, afk sr freth. The eeqeizee keqihhees the teot xa heefrevifg af ifzeese sgxstitgtirf. Sr the flag is f1_2hef-k3_hg1-vi-va_a

可以看出,替换后的语段中已经出现了不少“the”,同时还有重复出现的“sr”和“rf”,猜测“r”替代了原文的“o”。目前基本可以确定语段使用的是单表代换密码。但仅替换回 flag 前的四个单词无法保证最终得到的 flag 是正确的,于是去找了个按词频替换工具对语段进行爆破,得到 flag。爆破后的语段如下:
Xl fogkvryoeksg, e hjdhvxvjvxrl fxksao xh e zavsrb rc alfrbxly dg wsxfs jlxvh rc knexlvaiv eoa oaknefab wxvs fxksaovaiv, effrobxly vr e oayjneo hghvaz; the units may be single letters (the most common), pairs of letters, triplets of letters, mixtures of the above, and so forth. The receiver deciphers the text by performing an inverse substitution. So the flag is n1_2hen-d3_hu1-mi-ma_a

Flag

flag{n1_2hen-d3_hu1-mi-ma_a}

参考

CTF-ComyDream-github
Online - quipqiup