OS command injection is also known as shell injection. It allows an attacker to execute operating system(OS) commands on the server that is running an application.

 

 

 

Lab: OS command injection, simple case

 

 

[Information]

 

 

 

[Problem solving]

1. I went into the detailed view of one product, clicked the check stock button, and grabbed it as a proxy.

 

I inserted the "whoami" command into the productId parameter using | and sent a request to the server.

 

The lab was solved and the name of current user appeared at the bottom.


 

 

 

Lab: Blind OS command injection with time delays

 

 

[Information]

 

 

 

[Problem solving]

1. I accessed the lab, went to the feedback page, wrote the feedback and clicked the submit button with the proxy turned on.

 

2. I put "&sleep 10 #" in the name parameter, encoded url, and sent the request to the server. "&sleep 10 #" means asking the server to sleep for 10 seconds and annotating the string that follows so that it does not run. The intended request has not been forwarded because the name parameter does not have a vulnerability.

 

Next, I put the same value in the email parameter, encoded url, and requested it to the server, and the request was delivered as intended. This indicates that the email parameter is vulnerable.

 

The problem was solved.

  • 문제파일 및 디버거
  • 문제분석
  • 문제풀이

 

 

 

[문제파일 및 디버거]

 

crackme5.exe
0.01MB
odbg110.zip
1.28MB

 

 

 

[문제분석]

파일을 더블 클릭해서 연후 아무 시리얼 키를 입력하고 check 버튼을 클릭했다.

 

시리얼 키가 정확하지 않다고 에러창이 뜬다.

 

올리디버거를 켜서 문제파일을 올려서 프로그램을 한번 실행시켜 봤다. 이전과 똑같이 실행됨을 알 수 있다.

 

어셈블리어를 분석해 보면 CMP를 통해 EAX와 0을 비교하여 EAX의 값이 0과 같지 않다면(ZF=0) 하나의 메모리 주소를 뛰어넘고 Error 메시지 창을 띄우는 것 같다.

 

EAX의 값이 0과 같다면 바로 다음 주소를 실행해서 00401117 메모리 주소로 뛰어넘어가 "Well Done!"이라는 메시지 창을 띄우는 것 같다. 따라서 "Well Done!" 메시지 창이 나오게 하는 게 이 문제의 핵심일 것이다.

 

 

 

[문제풀이]

해당 문제의 풀이에는 하기와 같은 3가지 접근방식이 존재한다.

 

<1. 올바른 시리얼키 찾기>

우선 시리얼키를 입력하는 창의 메모리 주소를 찾기 위해 F2로 브레이크포인트 설정을 하고 F9으로 그전단계까지 실행한 다음 F8로 한 단계씩 실행하는 방식을 사용했다. 

 

분석을 해보면 00401110 메모리 주소에서 시리얼키를 입력하는 메시지 창이 뜨며 오른쪽 주석창을 봤을 때 "L2C-5791" 문장에다 "6794-ABEX" 문장을 이어 붙이는 것을 확인했다. 그리고 마지막으로 사용자가 입력한 시리얼 값인 "1234"와 해당 " L2C-5791 6794-ABEX" 문장을 비교하고 있는 것을 알 수 있다. 즉 비교해서 일치하면 EAX가 0, 일치하지 않다면 1로 설정되는 것이다. 입력한 값가 다르기에 실행 결과 EAX의 값이 1로 설정되어 있는 것을 볼 수 있으며 입력한 값과  " L2C-5791 6794-ABEX" 문장을 비교하는 것으로 봤을 때 " L2C-5791 6794-ABEX" 이게 올바른 시리얼 값이라고 추측할 수 있다.

 

다시 시작해서 " L2C-5791 6794-ABEX"를 시리얼 값으로 넣었더니 올바른 시리얼 값을 넣었다고 뜨고 EAX가 0으로 설정된 것을 확인할 수 있다. 

 

 

< 2. 제로 플래그값 변조 우회>

시리얼 값을 "1234"로 입력 후 한 단계씩 디버깅해 가며 JE에 도달했을 때 다음으로 뛰어 넘어가기 위해 제로 플래그의 값을 더블 클릭해서 1로 바꾸고 계속 실행하면 "Well Done!" 쪽으로 뛰어넘어가 올바른 값이 입력되었다는 창이 뜬다.

 

 

<3. EAX값 변조 우회>

시리얼 값을 "1234"로 이력 후 한 단계씩 디버깅해 가며 CMP에 도달했을 때 EAX의 값을 클릭해 0으로 만들어서 EAX와 0이 일치하게 하여 다음 문장이 실행되고 결과적으로 "Well Done!" 쪽으로 뛰어넘어가 올바른 값이 입력되었다는 창이 뜬다.

스테가노그래피란 겉으로 보기엔 평범한 이미지나 영상, 음악 파일 안에 전송하고자 하는 비밀정보를 숨기는 기법을 뜻한다.

 

 


<S-Tools를 이용한 실습>

 

1. S-Tools를 실행시킨 후 아무 이미지(예: zebras.bmp)나 올린다.

 

2. 은닉할 텍스트 파일(예: hidden.txt)을 하나 만들어서 글을 적은 후 이미지 파일 위에 드래그한다. 패스워드 설정과 아무 암호화 방식을 선택 후 OK를 클릭한다.

 

3. 은닉한 파일을 내포한 hidden data 이미지가 나타나게 되고 해당 이미지를 우클릭 후 다른 이름(예: zebras secret.bmp)으로 저장한다.

 

4. 파일을 은닉하고 있는 이미지 파일을 S-Tools에 다시 올린 후 우클릭->reveal->이전에 설정한 패스워드/암호화 방식을 선택하고 OK 클릭한다.

 

5. 새로운 창이 하나 뜨면서 Hidden.txt 파일이 내장되어 있는 것을 보여준다. 해당 텍스트 파일을 다른 이름(hidden secret.txt)으로 저장한다.

 

6. 저장한 텍스트 파일을 열어 확인해 본 결과 이전에 이미지 파일에 은닉했던 값과 일치하는 것을 확인할 수 있다.

 

 

 

 

Reference:

https://weekly.chosun.com/news/articleView.html?idxno=5508

https://www.cs.vu.nl/~ast/books/mos2/zebras.html

 

 

 

'hacking > Forensic' 카테고리의 다른 글

[Forensic] Surface Web & Deep Web & Dark Web  (0) 2023.10.06

Path traversal is also called directory traversal. These vulnerabilities enable an attacker to read unintended arbitrary files on the server that is running an application.

 

 

 

Lab: File path traversal, simple case

 

 

[Information]

 

 

 

[Problem solving]

1. In the lab you can find the display of product images.

 

 

2. I used the proxy tool to check all the logs and found "filename=image.jpg" queries, so I sent one of them to repeater. 

 

In the repeater tap, you can see the parameter "filename=58.jpg". 

 

I used "../" to go to the root path, then I set it up to access the "/etc/passwd" file and clicked the send button.

 

Finally, the lab was solved.


 

 

 

Lab: File path traversal, traversal sequences blocked with absolute path bypass

 

 

[Information]

 

 

 

[Problem solving]

1. I accessed the lab and grabbed the proxy.

 

2. There was a query "filename=51.jpg" on the burpsuit Logger tab, so I sent it to the repeater.

 

I attempted to access "/etc/passwd" from the root path by erasing 51.jpg in the filename query part and using "../../../". However, as you can see response message, the file could not be found.

 

According the the problem information, it can be seen that the application has blocked the traversal sequences. So I used absolute path instead of relative path in filename query. You can check that the request was successful by looking at the response message.

 

I went back to the web and reloaded, and the lab was solved.

 

 

 

 

Reference:

https://www.bugbountyclub.com/pentestgym/view/50

[Phishing]

 

'private1fishing'으로서 사회공학적 기법을 사용한 공격으로, 지인이나, 관련된 기관 등으로 사칭하여 이메일을 보내 의심 없이 열어보도록 하는 공격을 말한다. 글에 포함된 링크를 클릭하는 순간 악성코드 감염이나 악성 웹사이트로 이동시키는 방식을 사용한다. '피싱' 그 단어 자체 의미로 해석하면 사람들을 속여서 낚는다고 보면 된다. 

'spear-phishing'은 작살을 의미하며 특정인을 타겟으로 더 정교하게 제작하여 만든 피싱이라고 볼 수 있다.

 

 

 

[Smishing]

 

'SMS1phishing'으로서 pc가 아닌 스마트폰의 문자 메시지를 통해 이루어지는 피싱 공격을 말한다.

 

 

 

[Pharming]

 

기존에 존재하는 사이트와 비슷하게 생긴 사이트를 제작하고 비슷한 url 주소로 등록해 놓아 사람들이 실수로 접속하도록 유도하는 공격이다. 이는 사용자가 제대로 url을 입력하여도 피싱사이트로 연결시킬 수 있도록 설정할 수 있다.

 

 

 

[Scam]

 

신용사기를 일컬으며 사실 무근의  정보를 이용해 투자를 하도록 유인하고 돈을 받으면 잠적하는 행위 등을 의미한다.

If a virus is suspected in an object such as a file or url, you can test it in the following web browser.

https://www.virustotal.com/gui/home/upload

Authentication vulnerabilities are  weaknesses and flaws in the processes and mechanisms used to verify the identity of users or systems. This allows an attacker to access critical data and features.

 

 

 

Lab: Username enumeration via different responses

 

 

[Information]

 

 

 

[Problem solving]

1. First, I accessed the lab, and grabbed the proxy using burpsuite. After that I entered any value in the login window.

 

I checked HTTP communication history to check the caught proxy. There was a record indicating the "/login" path. So I send that to intruder. 

 

 

2. On the "Intruder" tab I marked $ only in the username part.

 

I copied the usernames from the username list and pasted them into the payload settings part and started to attack. 

 

In the results, the username named "ak" had a different length of data. It also shows the string "Incorrect password" at the response. This means that this is the correct username, but the password is incorrect.

 

Conversely, responses from other usernames display the string "Invalid username". This means that the username is wrong.

 

I modified the username to "ak" and marked $ only in the password part.

 

After that, I copied the passwords from the password list, pasted it into the payload settings section, and started the attack.

 

The results show that the state and data length of the password "love" are different from those of other passwords.

 

If you check the response parts of the other passwords, you will see the sentence "Incorrect password". Therefore, "love" is the correct password.

 

 

3. I logged in with "ak" in Username, "love" in Password and it was solved.


 

 

 

Lab: 2FA simple bypass

 

 

[Information]

 

 

 

[Problem solving]

1. I accessed the lab, and entered the "My account" page. Then I loged in by Victim's credentials.

 

There was a "Back to lab home" button, so I clicked it and accessed the homepage.

 

 

2. I went back to the "My account" page and the LAB was resolved.


 

 

 

Lab: Password reset broken logic

 

 

[Information]

 

 

 

[Problem solving]

1. I accessed to the lab, and went to "My account" page, clicked the "Forgot password" url.

 

I entered my credentials username in the form, and submitted it.

 

To verify a reset password link, I clicked the "Email client" button.

 

And accesed to the follow link.

 

Finally, I reset my password to "peter".

 

 

2. I used a proxy tool by burpsuite to view the logs of all communications. Among the logs, the "/forgot-password" log was found and sent to the repeater.

 

You can check it in the reapeater tap.

 

I deleted all the tokens and changed my username wiener to carlos. This means that You can login with "username=carlos, password=peter" without a token. After that, I clicked the send button.

 

I logged in with the username and password that setup in the previous step.

 

The lab was solved.

+ Recent posts