https://www.root-me.org/en/Challenges/Web-Client/Javascript-Authentication-2
Challenges/Web - Client : Javascript - Authentication 2 [Root Me : Hacking and Information Security learning platform]
TCP - Back to school just blocks when i try to read the flag after i have sent the calculation. Not sure if my calculation is wrong or what is is?
www.root-me.org
Start the challenge ๋ฒํผ์ ๋๋ฌ ๋ฌธ์ ๋ฅผ ํธ๋ ์นํ์ด์ง๋ก ์ด๋ํ์.
๊ฐ์ฅ ์ฒ์์ ํ๋ฉด์ด๋ค.
"Authentication" ๋ผ๋ ๋ฌธ๊ตฌ,
๊ทธ ์๋์ login ๋ฒํผ,
Close Window ๋ผ๋ ๋ฌธ๊ตฌ์ ๋งํฌ๊ฐ ๊ฑธ๋ ค์๋ค.
login ๋ฒํผ์ ๋๋ฅด๋ Username์ ์ ๋ ฅํ๋ผ๋ ํ์ ์ฐฝ์ด ๋ฌ๋ค.
์์ง์ ์๋ ๊ฒ ์์ผ๋
Username์ admin์ ์ ๋ ฅํ ๋ค ํ์ธ ๋ฒํผ์ ๋๋ฌ์ฃผ์๊ณ ,
๋ฐ๋ก ๋ค์์ ๋์ค๋ Password๋ admin์ ์ ๋ ฅํด์คฌ๋ค.
"Nope, you're a naughty hacker." ๋ผ๊ณ ์จ์๋ ํ์ ์ฐฝ์ด ๋ฌ๋ค.
๊ทธ๋ฆฌ๊ณ Close Window ๋ฅผ ๋๋ฌ์คฌ๋๋ ๋ฌธ์ ๋ฅผ ํ๋ ์ฐฝ์ด ๋ง ๊ทธ๋๋ก ๋ซํ๋ค.
F12 ๋ฅผ ๋๋ฌ ํ์ด์ง์ ์์ค ์ฝ๋๋ฅผ ์ดํด๋ณด์.
login ๋ฒํผ์ ๋ํ ์์ค์ฝ๋๋ฅผ ์ฝ๋ค๊ฐ ๊ถ๊ธํ ์ ์ด ์๊ฒผ๋ค.
connexion(); ์ ์ด๋ค ๋์์ ์ํํ๋ ๊ฒ์ผ๊น?
๋ ์ฐพ์๋ณด๋ connexion ํจ์์ ๋ํ ๋ด์ฉ์ ์ฐพ์ ์ ์์๋ค.
F12 ๋ฅผ ๋๋ฌ ํ์ด์ง์ ์์ค ์ฝ๋๋ฅผ ์ดํด๋ณด์.
function connexion(){
var username = prompt("Username :", "");
var password = prompt("Password :", "");
var TheLists = ["GOD:HIDDEN"];
for (i = 0; i < TheLists.length; i++)
{
if (TheLists[i].indexOf(username) == 0)
{
var TheSplit = TheLists[i].split(":");
var TheUsername = TheSplit[0];
var ThePassword = TheSplit[1];
if (username == TheUsername && password == ThePassword)
{
alert("Vous pouvez utiliser ce mot de passe pour valider ce challenge (en majuscules) / You can use this password to validate this challenge (uppercase)");
}
}
else
{
alert("Nope, you're a naughty hacker.")
}
}
}
์บก์ณํ๋ฉด์ ๊ธ์จ๊ฐ ์ ์ ๋ณด์ฌ์ ์์ค์ฝ๋๋ฅผ ๋ณต์ฌํด ์ฝ๋๋ธ๋ญ์ ์ฎ๊ฒจ๋ณด์๋ค.
์์ ์์ค์ฝ๋ ์ ์ฒด ์ค์
if (username == TheUsername && password == ThePassword)
{
alert("Vous pouvez utiliser ce mot de passe pour valider ce challenge (en majuscules) / You can use this password to validate this challenge (uppercase)");
}
์ด ๋ถ๋ถ์ด ๋์ ๋๋ค.
Username๊ณผ Password ์ ๋ํ ์ ๋ณด๊ฐ ๋์์๋ค๊ณ ์๊ฐํ๋ค.
username์นธ์๋ "TheUsername"์, password์นธ์๋ "ThePassword" ๋ฅผ ์ ๋ ฅํ๋ฉด ๋ฌธ์ ์ ์ ๋ต์ ์ ์ ์์ ๊ฑฐ๋ผ๊ณ ์๊ฐํ๋ค.
๊ทธ๋์ username์นธ์๋ "TheUsername"์, password์นธ์๋ "ThePassword" ๋ฅผ ์ ๋ ฅํด๋ณด์๋ค.
๊ทธ๋ฐ๋ฐ ๋ "Nope, you're a naughty hacker." ๋ผ๊ณ ์จ์๋ ํ์ ์ฐฝ์ด ๋ด๋ค.
๋ค์ ์์ค์ฝ๋๋ฅผ ์ดํด๋ณด์.
function connexion(){
var username = prompt("Username :", "");
var password = prompt("Password :", "");
var TheLists = ["GOD:HIDDEN"];
for (i = 0; i < TheLists.length; i++)
{
if (TheLists[i].indexOf(username) == 0)
{
var TheSplit = TheLists[i].split(":");
var TheUsername = TheSplit[0];
var ThePassword = TheSplit[1];
if (username == TheUsername && password == ThePassword)
{
alert("Vous pouvez utiliser ce mot de passe pour valider ce challenge (en majuscules) / You can use this password to validate this challenge (uppercase)");
}
}
else
{
alert("Nope, you're a naughty hacker.")
}
}
}
์ฌ์ค TheUsername ๊ณผ ThePassword ์ด ์๋ฏธํ๋ ๊ฒ์ ๋ฐ๋ก ์์๋ค.
๋ค์ ์๊ฐํด๋ณด๋ TheUsername ๊ณผ ThePassword์ด "" ์์ ๋ค์ด๊ฐ์๋ ๊ฒ๋ ์๋๋
๋ฌธ์์ด์ ์๋ฏธํ๋ ๊ฒ๋ ์๋์๋ค.... ใ ใ ;;
๋ค์ ํด์ํด๋ณด๋ฉด,
var TheSplit = TheLists[i].split(":");๋ถ๋ถ์
TheLists[i]์ ๊ฐ์ : ๊ธฐ์ค์ผ๋ก ๋๋์ด ๋ฐฐ์ด๋ก ์ ์ฅํ๋ค.
์ฆ, ์ฌ์ฉ์๋ช
๊ณผ ๋น๋ฐ๋ฒํธ๊ฐ ๊ฐ๊ฐ TheSplit[0]๊ณผ TheSplit[1]์ ์ ์ฅ๋๋ค.
var TheUsername = TheSplit[0];๋ถ๋ถ์
์ฌ์ฉ์๋ช
์ TheUsername ๋ณ์์ ์ ์ฅํ๋ค.
var ThePassword = TheSplit[1]; ๋ถ๋ถ์
๋น๋ฐ๋ฒํธ๋ฅผ ThePassword ๋ณ์์ ์ ์ฅํ๋ค.
if (username == TheUsername && password == ThePassword) ๋ถ๋ถ์
์ฌ์ฉ์๊ฐ ์
๋ ฅํ ์ฌ์ฉ์๋ช
๊ณผ ๋น๋ฐ๋ฒํธ๊ฐ TheLists ๋ฐฐ์ด์์ ๋ฐ๊ฒฌ๋ ์ฌ์ฉ์๋ช
๊ณผ ๋น๋ฐ๋ฒํธ์ ์ผ์นํ๋์ง ํ์ธํ๋ค.
alert("Vous pouvez utiliser ce mot de passe pour valider ce challenge (en majuscules) / You can use this password to validate this challenge (uppercase)"); ๋ถ๋ถ์
์กฐ๊ฑด์ด ์ถฉ์กฑ๋๋ฉด, ์ฌ์ฉ์์๊ฒ ํด๋น ๋ฉ์์ง๋ฅผ ๋์ด๋ค๋ ์๋ฏธ์ด๋ค. ์ฆ, ์ฌ๋ฐ๋ฅธ ์ฌ์ฉ์๋ช ๊ณผ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅํ ๊ฒฝ์ฐ์ด๋ค.
๊ทธ๋ฌ๋๊น ๊ฒฐ๋ก ์ ์ผ๋ก
":" ์ด์ ์ "GOD"๋ฅผ username์ ์ ๋ ฅํ๊ณ ,
"HIDDEN"์ password์ ์ ๋ ฅํ๋ฉด
"Vous pouvez utiliser ce mot de passe pour valider ce challenge (en majuscules) / You can use this password to validate this challenge (uppercase)" ๋ผ๊ณ ์ ํ ๋ฉ์์ง๋ฅผ ๋์ด๋ค๋ ๊ฒ์ด๋ค.
์ค์ ๋ก ํด๋ดค๋๋ ์์ค์ฝ๋๋ฅผ ํด์ํ๋๋ก ๋๋ค.
"Vous pouvez utiliser ce mot de passe pour valider ce challenge (en majuscules) / You can use this password to validate this challenge (uppercase)"์์ ์ด password๋ฅผ ์ด์ฉํด validate this challenge ํ ์ ์๋ค๊ณ ํ์ผ๋...
password ์๋ "HIDDEN"์ ์ ๋ต์ผ๋ก ์ ๋ ฅํด๋ณด์.
์ ๋ต!
'SWLUG > ์น ํดํน' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[webhacking.kr] old-12๋ฒ (0) | 2023.09.27 |
---|---|
[Root Me] Javascript - Webpack (0) | 2023.09.26 |
[Root Me] HTTP - COOKIES (0) | 2023.09.23 |
[webhacking.kr] old-19๋ฒ (0) | 2023.09.19 |
[webhacking.kr] old-42๋ฒ (0) | 2023.09.18 |