News for hackers. Stuff that matters.
Re:Out of sight but not invisible: Defeating fileless malware by FreakLegion on Saturday April 27, 2019 @06:20PM (#19767985)
> what I didn't understand is why Microsoft allows users to run random JS code from Internet with full privileges

The short version is they don't. Cscript and wscript are akin to PowerShell and they aren't talking about JS from the Web.

The way it works is, say, the attacker sends the script (direct) as an email attachment and tricks the target into running it, or sends a document (indirect) that drops and runs the script, and tricks the target into opening that. They've even taken to having executables drop and run scripts to offload malicious activity into otherwise trusted processes without setting off alarms, like injection does.

In the indirect cases, cscript/wscript aren't the only options for JS. You can also:

    rundll32.exe javascript:"\..\mshtml,RunHTMLApplication ";new%20ActiveXObject('Shell.Application').ShellExecute('calc.exe');
But Microsoft is overstating the difficulty of detecting these attacks. For example obfuscation isn't a barrier to detection; in fact obfuscation can itself be detected and is a fantastic signal for blocking this stuff. General Windows system behavior, on the other hand, is chaotic[1], so in practice you're limited to writing rules for e.g. what child processes winword.exe isn't allowed to create, but even then you'll need exemptions for certain teams.

1. uTorrent for example creates child processes in a way that's practically indistinguishable from malware:

    C:\WINDOWS\System32\mshta.exe C:\WINDOWS\System32\mshta.exe" "C:\DOCUME~1\<USER>~1\LOCALS~1\Temp\HYD4.tmp.1548293039\HTA\index.hta?utorrent" "C:\5ee283553c4ab530c77f19785f6092cabfd8e48a5eefd808cb53aecea4399dd9" /LOG "C:\DOCUME~1\<USER>~1\LOCALS~1\Temp\HYD4.tmp.1548293039\index.hta.log" /PID "1076" /CID "sDbhVc2tIx6wzwCd" /VERSION "111849449" /BUCKET "0" /SSB "1" /COUNTRY "US" /OS "5.1" /BROWSERS "\"C:\Program Files\Internet Explorer\iexplore.exe\"" /USERTYPE "admin" /ARCHITECTURE "32" /LANG "en" /USERNAME "<USER>" /CLIENT "utorrent""
    C:\WINDOWS\system32\cscript.exe C:\WINDOWS\system32\cscript.exe" "shell_scripts/check_if_cscript_is_working.js""
    C:\WINDOWS\system32\cscript.exe C:\WINDOWS\system32\cscript.exe" shell_scripts/shell_ping_after_close.js "http://i-50.b-000.XYZ.bench.utorrent.com/e?i=50&e=eyJldmVudE5hbWUiOiJoeWRyYTEiLCJhY3Rpb24iOiJmYWlsR2VuZXJhbCIsInR5cGUiOiJpIiwiZXJyb3IiOiJFcnJvcjogVW5hYmxlIHRvIHdhaXQgZm9yIHByb2Nlc3MuOyBmaWxlOiBmaWxlOi8vLmpzOyBsaW5lOiAxMCJ9" "
Re:Out of sight but not invisible: Defeating fileless malware by tinus_hn on Sunday April 28, 2019 @03:08PM (#19773030)
Pretty easy to defeat: don’t allow executable attachments.
Re:Out of sight but not invisible: Defeating fileless malware by FreakLegion on Sunday April 28, 2019 @04:05PM (#19773361)
Most companies don't, for actual executables (PE files) and scripts. So for example:

1. Attackers use documents, because it isn't realistic to disallow documents over email as a matter of policy.

2. Attackers use download links (Box, OneDrive, etc.), because it isn't realistic to disallow URLs in email as a matter of policy.

3. Attackers put the naughty bits in password-protected archives, which aren't realistic for most companies to disallow over email as a matter of policy. Some will, though.

On and on. Policy is great and you should use it as much as possible, but at some point usability always wins out. Obviously there's a business opportunity there, and companies like Proofpoint and Mimecast have stepped in to fill the gap.

Re:Out of sight but not invisible: Defeating fileless malware by tinus_hn on Sunday April 28, 2019 @05:15PM (#19773730)
Pretty easy to defeat: downloaded and extracted executables are quarantined. And documents can’t ‘drop and run scripts’, they are documents. And by the way, try sending a password protected archive in the mail once. Most services just throw them away.
Re:Out of sight but not invisible: Defeating fileless malware by FreakLegion on Sunday April 28, 2019 @06:02PM (#19773988)
> downloaded and extracted executables are quarantined

The vast majority of companies won't implement a security policy that strict, even if they can distinguish email attachment downloads from other sources, which they generally can't (ADS doesn't capture it directly).

> And documents can’t ‘drop and run scripts’, they are documents

Yes they can, and do, without needing exploits, for both legitimate and illegitimate reasons. The legitimate reasons are why, again, the vast majority of companies won't implement blanket security policies here.

> And by the way, try sending a password protected archive in the mail once. Most services just throw them away.

Incorrect. You can do whatever you want with your personal email, but we're talking about enterprise security. Few companies (but more than the above two cases) will block password-protected anything as a matter of policy.

In practice, none of what you're saying will be done because of the downstream problems it creates for IT and security teams.

Re:Out of sight but not invisible: Defeating fileless malware by codedokode on Sunday April 28, 2019 @06:35PM (#19774159)
> The vast majority of companies won't implement a security policy that strict

Maybe such policy should be the default; by default the employee should be able to run only applications installed (or approved) by their sysadmin, and applications are sandboxed like Android's ones.

In 80s when DOS was developed, there were no easy access to the Internet, no phishing letters and viruses, so there were no risk in running different executables. But today this outdated security model simply doesn't work. You allow employees to download and run executables and they open "yearly-report.doc.exe".

Maybe desktop system developers should look at iPhones and Androids. It is difficult to dowload and run a virus on an iPhone; and it doesn't require the user to deal with configuration settings - it works out of the box. Something similar could be done for desktop systems: a pre-approved catalog of known "good" software and a simple UI (that doesn't require special skills) to whitelist any other software.

Also, I think that applications and documents should look different; today you can assign an icon of Word document to an executable; running an executable is indistinguishable from opening a document; that's wrong. Maybe applications should be located only in special application directory and run from there.

Re:Out of sight but not invisible: Defeating fileless malware by tinus_hn on Monday April 29, 2019 @06:46AM (#19777224)
> The vast majority of companies won't implement a security policy that strict

That’s what Windows does. You can’t not implement it.

Re:Out of sight but not invisible: Defeating fileless malware by anon4242 on Saturday April 27, 2019 @07:41PM (#19768362)
Yeah, about uTorrent... didn't we agree long ago that it could no longer be trusted..?