Msfvenom
Msfvenom, thankfully, is allowed to be used in the exam.
We can use it to generate our custom payload, which we will then put into our exploit.
if you’re doing the OSCP exam, stick to standard reverse shell payloads not Meterpreter ones. Meterpreter is forbidden in the OSCP exam.
Staged vs unstaged
unsgaed: windows/shell_reverse_tcp
staged : windows/shell/reverse_tcp
staged와 unstaged의 차이점은? unstaged 페이로드(payload)를 사용하면 전체 페이로드(payload)가 한 번에 전송되어 대상 시스템에서 실행된다. simple 넷캣 리스너로 쉘을 잡을 수 있고 잘 작동한다는 뜻이다.
staged 페이로드(payload)를 사용하는 경우 Metasploit multi handler를 사용하여 셸을 잡아야 한다.(이것은 시험에서 허용된다, 그건 그렇고!). 만약 넷캣 리스너를 이용해 shell을 잡으려하면 연결이 수신된 다음 끊어질 것이다.
staged 페이로드는 초기 페이로드가 더 작다. 그것은 로컬 박스의 Metasploit handler에서 전체 페이로드를 다운로드한다. exploit 공간이 많지 않다면 그것들은 훌륭하다. 어느 것을 사용해야 하는가? 그건 네 마음이야. 가변적인 세계에서는 때로는 한쪽이 작용하는 반면 다른 한쪽은 그렇지 않을 때가 있기 때문에, 두 가지 모두를 당신의 트릭에 넣는 것이 좋다!
Other MSFVenom options?
There’s plenty of other options to sink your teeth into, but they’re out of the scope for this article — Here’s a little list of the most common you’ll probably use that haven’t been covered already:
-e will allow you to choose an encoder, the most common of which is x86\shikata_ga_nai. This is great for avoiding bad characters and evading AV… Although, the latter isn’t so true anymore.
-b allows you to set bad characters. The bad characters for a specific exploit are often disclosed in the public exploit code itself.
— list (that’s two dashes) will list payloads and formats, for example, if you want to see a list of all the possible payloads, run msfvenom --list payloads
Privilege Escalation
Sometimes, privilege escalation with Metasploit is as easy as 1, 2, get_system. Unfortunately, without Metasploit, it’s not usually that easy. Let me start by saying, this is a huge topic. Far too large for my humble article, but I’ll provide a little primer here and try to point you in the right direction.
Firstly — no Windows privesc tips would be complete without a reference to the legendary “FuzzySecurity Windows Privilege Escalation” article. It covers the fundamentals of manual Windows privesc very well!
http://www.fuzzysecurity.com/tutorials/16.html
Secondly — Windows exploits can be annoying to get compiled on a Linux system. If you’re trusting, you can download pre-compiled exploits from Github repositories like this one.
https://github.com/SecWiki/windows-kernel-exploits
Thirdly — That same repository comes with a nice spreadsheet which can help you identify which exploits are the most likely to work. You can download it here.
https://github.com/SecWiki/windows-kernel-exploits/raw/master/win-exp-suggester/2017-06-14-mssb.xls
Catching Reverse Shells
The good news is, this process doesn’t change a whole lot in OSCP.
The main difference is that you can’t use Meterpreter.
How can we get around this? Just use plain reverse shell payloads instead.
Last I checked, you are allowed to use exploit/multi/handler in Metasploit to catch shells. This doesn’t have much of an advantage over using a plain old netcat listener though, seeing as you can’t use Meterpreter or Metasploit’s other features anyway.
The only exception is if you are using an exploit which has restrictive space for a payload, in which case, you might need to use a staged payload.
*Reminder: staged payloads don’t work with netcat! You must use Metasploit’s exploit/multi/handler module.
If you decide to go the Netcat route, simply start a listener using the following syntax.
nc -nvlp [port number]
'OSCP > 도구 개념 정리' 카테고리의 다른 글
Kali to Windows, rdesktop 파일 복사 (0) | 2020.06.14 |
---|---|
mona (0) | 2020.05.14 |
32bit Windows From Fuzzing to Buffer Overflow (0) | 2020.04.28 |
Exploiting wildcards on Linux - 권한상승 (0) | 2020.04.24 |
Meterpreter (0) | 2020.04.13 |