해킹 동아리 I.Sly()/심화 트랙 활동_파일 다운로드 취약점

[써니나타스] web challenge 01

gom1n 2021. 5. 22. 06:59

web challenge 01

 

 

주소창을 보니 asp파일인 것을 확인할 수 있고, 

입력창에 입력한 값이 곧 str값이라는 것을 알 수 있었다.

 

 

 

코드 분석에 앞서 Replace함수와 MID함수를 알아보자.

Replace함수 : 치환함수

예시) Replace(str, "abc", "def") - str스트링의 "abc"문자열을 "def"로 치환.

Mid함수: 문자열을 뽑아오는 함수

예시) Mid(str, 2, 2) - str스트링의 2번째 자리에서부터 2개의 문자를 반환.

 

 

 

코드분석)

str = Request("str") 

요청한 값을 str에 저장

If not str = "" Then 

만약 str이 ""(빈문자열)이라면

   result = Replace(str, "a", "aad") 

   result는 str의 "a"를 "aad"로 치환한 값

   result = Replace(str, "i", "in") 

   result는 str의 "i"를 "in"으로 치환한 값

   result1 = Mid(result, 2, 2) 

   result1은 result의 2번째 문자에서부터 2개를 반환한 값

   result2 = Mid(result, 4, 6) 

   result2는 result의 4번째 문자에서부터 6개를 반환한 값

   result = result1 & result2 

   result는 result1와 result2를 합친 값

   Response.write result 

   If result = "admin" Then   

   만약 result가 "admin"이라면

      pw = "????????"

   End if

End if

 

결과값이 admin이 되게 하는 게 목표인 것 같다.

 

 


 

정답) ami

ami를 입력하면 (초반)result는 aadmin이 되고,

result1 은 ad, result2는 min이 되어 최종적으로 result값은 admin이 된다.