⏪
CTFs
TwitterGithub
  • 👋Introduction
  • 📚Write Up
    • 2024
      • 📖1337UP LIVE CTF
        • Reverse Engineering
        • Mobile
        • Forensic
        • Misc
      • 📖HKCERT CTF Quals
        • Reverse Engineering
        • Binary Exploitation
      • 📖Flare-On 11
        • Challenge #1 - frog
      • 📖Intechfest
        • Reverse Engineering
        • Forensic
        • Cryptography
        • Mobile
      • 📖Cyber Breaker Competition (1v1)
        • Reverse Engineering
        • Web Exploitation
        • Cryptography
        • Binary Exploitation
      • 📖Cyber Breaker Competition Quals
        • Reverse Engineering
        • Web Exploitation
        • Cryptography
      • 📖BlackHat MEA Quals
        • Reverse Engineering
        • Forensic
      • 📖TFC CTF
        • Reverse Engineering
        • Forensic
        • Misc
      • 📖DeadSec CTF
        • Reverse Engineering
        • Web Exploitation
      • 📖Aptos - Code Collision CTF
        • Reverse Engineering
        • Misc
      • 📖DownUnder CTF
        • Reverse Engineering
      • 📖JustCTF
        • Reverse Engineering
        • Forensic
        • Misc
      • 📖Akasec CTF
        • Reverse Engineering
        • Forensic
      • 📖Codegate CTF Preliminary
        • Reverse Engineering
      • 📖NahamCon CTF
        • Cryptography
        • Reverse Engineering
        • Malware
        • Misc
        • Mobile
        • Scripting
        • Web Exploitation
        • Forensic
      • 📖SAS CTF Quals
        • Reverse Engineering
      • 📖SwampCTF
        • Reverse Engineering
        • Misc
        • Cryptography
      • 📖UNbreakable International
        • Reverse Engineering
        • Network
        • Cryptography
      • 📖ACSC
        • Reverse Engineering
        • Hardware
        • Web Exploitation
      • 📖0xL4ugh
        • Mobile
    • 2023
      • 📖BlackHat MEA Final
        • Reverse Engineering
        • Web Exploitation
      • 📖Flare-On 10
        • Challenge #1 - X
        • Challenge #2 - ItsOnFire
        • Challenge #3 - mypassion
        • Challenge #4 - aimbot
        • Challenge #5 - where_am_i
        • Challenge #6 - FlareSay
        • Challenge #7 - flake
        • Challenge #8 - AmongRust
        • Challenge #9 - mbransom
        • Challenge #10 - kupo
        • Challenge #11 - over_the_rainbow
        • Challenge #12 - HVM
        • Challenge #13 - y0da
      • 📖LakeCTF Quals
        • Reverse Engineering
        • Cryptography
      • 📖TSG CTF
        • Reverse Engineering
        • Cryptography
      • 📖ISITDTU Quals
        • Web Exploitation
        • Misc
        • Reverse Engineering
      • 📖BlackHat MEA Quals
        • Reverse Engineering
      • 📖ASCIS Final
        • Reverse Engineering
        • Web Exploitation
        • Cryptography
      • 📖ASCIS Quals
        • Reverse Engineering
        • Forensic
        • Cryptography
      • 📖IFest
        • Reverse Engineering
        • Cryptography
        • Misc
      • 📖Cyber Jawara International
        • Reverse Engineering
        • Forensic
        • Cryptography
        • Web Exploitation
      • 📖Intechfest
        • Reverse Engineering
        • Forensic
        • Cryptography
        • Mobile
      • 📖CSAW Quals
        • Reverse Engineering
      • 📖SECCON Quals
        • Reverse Engineering
      • 📖CTFZone Quals
        • Reverse Engineering
      • 📖Securinets Quals
        • Reverse Engineering
      • 📖Compfest Final (Attack Defense)
        • Web Exploitation
        • Cryptography
      • 📖Compfest Quals
        • Reverse Engineering
        • Cryptography
        • Forensic
        • Misc
      • 📖Tenable
        • Reverse Engineering
        • Cryptography
        • Steganography
      • 📖ASCWG Quals
        • Reverse Engineering
        • Cryptography
      • 📖Gemastik Quals
        • Reverse Engineering
      • 📖BSides Indore
        • Reverse Engineering
        • Cryptography
      • 📖NahamCon CTF
        • Cryptography
      • 📖HSCTF
        • Reverse Engineering
        • Cryptography
        • Web Exploitation
        • Misc
      • 📖ACSC
        • Reverse Engineering
      • 📖HackTM Quals
        • Reverse Engineering
    • 2022
      • 📖Intechfest
        • Reverse Engineering
        • Mobile
        • Cryptography
      • 📖NCW Final
        • Reverse Engineering
      • 📖NCW Quals
        • Reverse Engineering
        • Misc
        • Cryptography
      • 📖Compfest Final
        • Reverse Engineering
        • Forensic
      • 📖Compfest Quals
        • Reverse Engineering
        • Cryptography
      • 📖IFest
        • Reverse Engineering
        • Cryptography
        • Forensic
    • 2021
      • 📖Cyber Jawara Final
        • Reverse Engineering
      • 📖Cyber Jawara Quals
        • Reverse Engineering
        • Cryptography
      • 📖DarkCon CTF
        • Reverse Engineering
      • 📖Wreck IT Quals
        • Mobile
      • 📖MDT4.0 Final
        • Reverse Engineering
        • Cryptography
        • Forensic
      • 📖MDT4.0 Quals
        • Reverse Engineering
        • Cryptography
      • 📖IFest
        • Reverse Engineering
        • Cryptography
      • 📖Compfest Final
        • Reverse Engineering
      • 📖Compfest Quals
        • Reverse Engineering
        • Cryptography
    • 2020
      • 📖Deep CTF
        • Reverse Engineering
  • 🚩Lifetime CTF
    • 📖Hack The Box
      • Reverse Engineering
        • TBU
Powered by GitBook
On this page
  • Notes Manager (113 pts)
  • Description
  • Solution
  1. Write Up
  2. 2024
  3. Intechfest

Cryptography

Challenge
Link

Notes Manager (113 pts)

Notes Manager (113 pts)

Description

-

Solution

Diberkan file .class, decompile dengan luyten.

import java.util.Arrays;

class Coba
{
    public static int[][] multiply(final int[][] array, final int[][] array2) {
        final int length = array.length;
        final int length2;
        final int n = length2 = array2[0].length;
        final int[][] array3 = new int[length][length2];
        for (int i = 0; i < length; ++i) {
            for (int j = 0; j < length2; ++j) {
                for (int k = 0; k < n; ++k) {
                    final int[] array4 = array3[i];
                    final int n2 = j;
                    final int[] array5 = array4;
                    final int n3 = n2;
                    array5[n3] += array[i][k] * array2[k][j];
                }
            }
        }
        return array3;
    }
    
    public static int[][][] string_to_matrix(final String s) {
        final int[][][] array = new int[s.length() / 9][3][3];
        for (int i = 0; i < s.length(); i += 9) {
            final int[][] array2 = new int[3][3];
            for (int j = 0; j < 9; ++j) {
                array2[j / 3][j % 3] = s.charAt(i + j);
            }
            array[i / 9] = array2;
        }
        return array;
    }
    
    public static void main(final String[] array) {
        final int[][][] string_to_matrix = string_to_matrix("123456789");
        final int[][] multiply = multiply(string_to_matrix[0], string_to_matrix[0]);
        for (int i = 0; i < multiply.length; ++i) {
            System.out.println(Arrays.toString(multiply[i]));
        }
    }
}

Dapat dilihat bahwa program menerima input kita lalu mengubahnya ke bentuk matrix 3x3 dan melakukan matrix multiplication. Matrix multiplication yang dilakukan adalah matrix-i dikali matrix-0. Karena kita tahu 9 bytes pertama dari flag yaitu INTECHFES jadi lakukan matrix multiplication inverse terhadap keseluruhan nilai CT untuk mendapatkan flag. Berikut solver yang kami gunakan.

base = list(b"INTECHFES")

data = "16591 16716 18720 14700 14839 16596 15681 15810 17737 23089 23142 25955 18377 18305 20521 14746 14738 16272 19214 19535 21465 22507 22778 25463 19780 19694 22182 18507 18417 20641 18043 18278 20120 21986 22215 24733 19077 19278 21221 23126 23249 26010 19701 19598 22096 17963 17903 20089 17817 17747 19921 19586 19894 22442 16831 16778 18597 13356 13482 15057 13356 13482 15057"
tmp = list(map(int, data.split(" ")))
mat = []
for i in range(0, len(tmp), 9):
    zz = []
    for j in range(i, i + 9, 3):
        z = []
        for k in range(3):
            z.append(tmp[j + k])
        zz.append(z)
    mat.append(zz)

bm = Matrix(3,3, base)
flag = b""
for i in mat:
	tmp = Matrix(i)
	res = bm.solve_left(tmp)
	for j in list(res):
		for k in j:
			flag += bytes([k])
print(flag)

Flag: INTECHFEST{y3t_4n0th3r_m4tr1x_ch4ll_bu7_wr1tt3n_1n_j4v4}

PreviousForensicNextMobile

Last updated 5 months ago

📚
📖
Here