← Back to Writeups
CUSTOMEasyCrypto

Кракозябры (Krakozyabry)

XESXOR9/2/20263 min read
#crypto#custom#easy#character-encoding-chain-analy#encoding-mismatch-reconstructi#multi-encoding-reversal

Кракозябры (Krakozyabry)

Platform: CUSTOM | Category: Crypto | Type: Challenge | Difficulty: Easy | OS: N/A | **Author: XESXOR Techniques: Character encoding chain analysis, Encoding mismatch reconstruction, Multi-encoding reversal

Summary

Walkthrough of the CUSTOM Crypto Кракозябры (Krakozyabry). Task: Decode garbled Russian text (krakozyabry/mojibake) from a file with multiple encoding chains. Solution: Reverse encoding chains (UTF-8 -> KOI8-R -> CP1251, UTF-8 -> CP1251, UTF-8 -> GBK) to reco

Description

"Похоже, что тут используется несколько языков...Хотя что это вообще за языки?"

(It seems that several languages are used here... Although what kind of languages are these?)

Analysis

"Кракозябры" (krakozyabry) is a Russian slang term for garbled/mojibake text that appears when encoding is incorrectly interpreted. This is a classic problem of the Russian-speaking internet, when text in one encoding (e.g., UTF-8) is read as another (e.g., CP1251 or KOI8-R). ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

The file task.txt contains three lines with different types of "krakozyabry", each corrupted by its own encoding chain:

Typical encodings for Russian text:

  • UTF-8 - modern Unicode standard
  • CP1251 (Windows-1251) - Windows encoding for Cyrillic
  • KOI8-R - Soviet/Russian encoding
  • CP866 - DOS encoding for Cyrillic
  • ISO-8859-5 - international standard for Cyrillic

Chinese encoding:

  • GBK/GB18030 - Chinese encoding that sometimes "captures" UTF-8 bytes

Solution

Analysis of each line

‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Line 1: UTF-8 -> KOI8-R -> CP1251 -> UTF-8

Original text: "Поздравляем! Если Вы видите данное сообщение, то скорее всего Вы уже решили задание."
(Congratulations! If you see this message, you have probably already solved the task.)

Line 2: UTF-8 -> CP1251 -> UTF-8

Original text: "В качестве флага используйте стандартное обрамление Кодебай."
(Use standard Codeby framing as the flag.)

Line 3: UTF-8 -> GBK -> UTF-8

Original text: "В скобках укажите по-английски в нижнем регистре название самой популярной операционной системы."
(In brackets, specify in English in lowercase the name of the most popular operating system.)

‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Python solution

python
#!/usr/bin/env python3
"""
Krakozyabry decoder - text recovery from encoding chains
"""

with open('task.txt', 'rb') as f:
    data = f.read()

# Split by Windows line endings
lines = data.split(b'\r\n')

# Line 0: UTF-8 -> KOI8-R -> CP1251 -> UTF-8
# Reverse chain: decode UTF-8 -> encode KOI8-R -> decode CP1251 -> encode CP1251 -> decode UTF-8
line0 = lines[0].decode('utf-8').encode('koi8-r').decode('cp1251').encode('cp1251').decode('utf-8')
print(f"Line 1: {line0}")

# Line 2: UTF-8 -> CP1251 -> UTF-8
# Reverse chain: decode UTF-8 -> encode CP1251 -> decode UTF-8
line2 = lines[2].decode('utf-8').encode('cp1251').decode('utf-8')
print(f"Line 2: {line2}")
‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

# Line 4: UTF-8 -> GBK -> UTF-8
# Reverse chain: decode UTF-8 -> encode GBK -> decode UTF-8
line4 = lines[4].decode('utf-8').encode('gbk').decode('utf-8')
print(f"Line 3: {line4}")

Decoding result

Line 1: Поздравляем! Если Вы видите данное сообщение, то скорее всего Вы уже решили задание.
Line 2: В качестве флага используйте стандартное обрамление Кодебай.
Line 3: В скобках укажите по-английски в нижнем регистре название самой популярной операционной системы.

Answer

The most popular operating system in the world is Windows (by number of desktop users). ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Typical encoding chains for Russian text

OriginalInterpreted asResult
UTF-8CP1251Double symbols like "Р"
UTF-8KOI8-RScrambled letters
CP1251UTF-8Question marks or diamonds
KOI8-RCP1251Upper/lowercase inversion

Analysis tools

  • ftfy (Python) - automatic mojibake correction
  • chardet - encoding detection
  • iconv - conversion between encodings
  • enca - encoding detection for Slavic languages

References

‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Key Takeaways / Lessons

  • Mastering Character encoding chain analysis, Encoding mismatch reconstruction, Multi-encoding reversal was key to this challenge.
  • Always check for common misconfigurations and verify assumptions.

Crafted by XESXOR Research • 2026-01-01 • CUSTOM • Кракозябры (Krakozyabry) • Difficulty: Easy