Planet DesKel

DesKel's official page for CTF write-up, Electronic tutorial, review and etc.

30 August 2020

Webhacking.kr write-up: old-12

1 minutes to read
Link point tag
old-12 250 JavaScript

Howdy there, welcome to another weird CTF challenge on webhacking.kr. Today, we are walking through a JavaScript challenge.

question

Huh, look like there is nothing on the front page except a small hints. How about the source code.

AAencode

Alright, this is an AAencoded text where I have included a similar challenge in CTF100, tryhackme. Simply use an online AAdecoder to reveal the JS code.

decoded

Understand the code is easy, you just need to follow the enco() function that converts the char code to ASCII and concatenates the strings.

  1. The for loop generate all ASCII character from 1 to 121
  2. The enco function used to find the indexed ASCII character from variable enco

If you’re lazy, drop the code to the JS online compiler

var enco='';
var enco2=126;
var enco3=33;
var ck=document.URL.substr(document.URL.indexOf('='));
for(i=1;i<122;i++){
  enco=enco+String.fromCharCode(i,0);
}
function enco_(x){
  return enco.charCodeAt(x);
}

console.log(String.fromCharCode(enco_(240))+String.fromCharCode(enco_(220))+String.fromCharCode(enco_(232))+String.fromCharCode(enco_(192))+String.fromCharCode(enco_(226))+String.fromCharCode(enco_(200))+String.fromCharCode(enco_(204))+String.fromCharCode(enco_(222-2))+String.fromCharCode(enco_(198))+"~~~~~~"+String.fromCharCode(enco2)+String.fromCharCode(enco3)+".php")

code

Visit the php and pwn the web.

solve

tags: webhacking.kr - javascript

Thanks for reading. Follow my twitter for latest update

If you like this post, consider a small donation. Much appreciated. :)


Vortex


© 2020 DesKel