← Back to Writeups
CUSTOMMediumReversing

Nava - ASIS CTF Reverse Challenge

XESXOR9/10/20263 min read
#reversing#custom#medium#na

Nava - ASIS CTF Reverse Challenge

Platform: ASIS CTF | Category: Reversing | Type: Challenge | Difficulty: Medium | OS: NA | Author: XESXOR | Date: 2025-12-28 | Status: Solved Techniques: NA

Summary

Task: extract a flag from a binary that transforms a 400x80 bitmap. Solution: count 1-pixels per column in the input bitmap, group by 8 columns, divide sums by 8, XOR with 0xFF to get ASCII characters forming the flag.

Nava - ASIS CTF Reverse Challenge

Information

  • Event: ASIS CTF
  • Task: Nava
  • Category: reverse
  • Format: ASIS{...}
  • Difficulty: Medium
  • Solved: Yes

Description

"visualization isn't modern art, so stop admiring it, reverse the pixels, and extract the secret flag now!"

Files

  • Nava.txz - Archive containing:
    • nava - 64-bit ELF stripped binary
    • output - Input bitmap (400 lines × 80 chars of 0/1)
    • font_*.txt - 80x80 pixel representations of characters (0-9, A-Z, _, {, }) ‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍

Solution

Analysis

The binary takes a 400×80 bitmap as input and transforms it into a 518,400×80 output (1296× expansion per row). However, the flag is encoded directly in the input bitmap structure.

Key Insight

The input bitmap encodes the flag by counting '1' pixels in column groups of 8:

  1. Count total '1's in each of the 80 columns
  2. Group columns by 8 and sum each group (10 groups total)
  3. Divide each sum by 8
  4. XOR each value with 0xFF to get ASCII character code
  5. Filter out non-printable ASCII (padding)
  6. Result is the flag content ‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍

Column Group Pattern

ColumnsSum÷8XOR 0xFFChar
0-700255ÿ (padding)
8-151216152103g
16-23134416887W
24-31140817679O
32-39128016095_
40-471088136119w
48-55140817679O
56-63134416887W
64-711216152103g
72-7900255ÿ (padding)

Result

  • Decoded string: gWO_wOWg
  • Flag: ASIS{REDACTED} ‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍

Solve Script

python
#!/usr/bin/env python3
def solve():
    with open('output', 'r') as f:
        lines = f.readlines()
    
    # Count 1s per column
    col_counts = [0] * 80
    for line in lines:
        for i, c in enumerate(line.strip()):
            if c == '1':
                col_counts[i] += 1
    
    # Group by 8 columns and decode
    result = []
    for i in range(0, 80, 8):
        group_sum = sum(col_counts[i:i+8])
        value = group_sum // 8
        decoded = value ^ 0xFF
        if 32 <= decoded <= 126:  # Printable ASCII
            result.append(chr(decoded))
    
    print(f"ASIS{{{''.join(result)}}}")

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

Key Observations

  1. The column values form a symmetric pattern: [0, 152, 168, 176, 160, 136, 176, 168, 152, 0]
  2. The first and last groups (value 0) are padding and should be excluded
  3. XOR with 0xFF is the key transformation to get readable ASCII
  4. The font files (80×80 pixel representations) show that character complexity varies, but are not directly used in decoding

Tags

  • reverse
  • pixel counting
  • xor encoding
  • bitmap analysis ‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍