vault-door-3

https://play.picoctf.org/playlists/13?m=83

  • similar to [[vault-door-1]]

public boolean checkPassword(String password) {
	if (password.length() != 32) {
		return false;
	}
	char[] buffer = new char[32];
	int i;
	for (i=0; i<8; i++) {
		buffer[i] = password.charAt(i);
	}
	for (; i<16; i++) {
		buffer[i] = password.charAt(23-i);
	}
	for (; i<32; i+=2) {
		buffer[i] = password.charAt(46-i);
	}
	for (i=31; i>=17; i-=2) {
		buffer[i] = password.charAt(i);
	}
	String s = new String(buffer);
	return s.equals("jU5t_a_sna_3lpm18g947_u_4_m9r54f");
}
  • lets create a function that reverses this

  • create a array with the characters jU5t_a_sna_3lpm18g947_u_4_m9r54f

  • going backwards, lets copy the last for loop, but with s instead of password

  • the first 3 for loops continue each other, so we need to find the start of each one, which would be 0, 8, and 16

  • print flag in the function

  • add our printFlag(); function to the main

  • and run and enclose flag in picoCTF{} format

Last updated