594 points · by runesoerensen · 9y ago · 180 comments
Double You Tee Eff.
Why would mpengine ever want to evaluate javascript code coming over the network or file system? Even in a sandboxed environment?
What could they protect against by evaluating the code instead of just trying to lexically scan/parse it?
(I'm sure they had a reason - wondering what it is)
I've known for over a decade that antivirus products are strangely destabilizing and stayed away from them myself. For the last year or so that Tavis has been investigating them, we know why. They're just really dumb. Because the popular commercial computer security product market is a "market for lemons": https://www.schneier.com/blog/archives/2007/04/a_security_ma...
It seems pretty obvious now that I think about it, and it definitely goes hand-in-hand with the "Confusopoly" concept (https://en.wikipedia.org/wiki/Confusopoly).
Why should companies compete on quality or price when they can put all that effort into advertising and marketing that scares or confuses most people into buying their product
1) Why are there only binary (2) qualities of cars - good or bad. And why are they static? What market is this trying to model? 2) Wouldn't it be sufficient for peaches (as opposed to lemons) to be lowered in cost to market price i.e. the avg. Somehow peaches are of immutable cost/ quality with zero seller margins?
Aside: 1) Also, why is the state of the cars being considered to be unknowable i.e. even in a given model of car, the units are not of consistent quality? Is this a production quality issue (i.e. inconsistent quality of units in a given model)
2) Why is this state of unknowable or perhaps inconsistent quality an equilibrium? meaning wouldn't a middle man who tests cars try and separate the lot and charge for his services?
This market situation that is being modeled seems contrived, at least to the extent that I understand from the Market for lemons wikipedia article
If it was the case that peaches can't be produced at prices a customer is willing to pay, then the market splits to high-end and low-end with two types of customers with different paying ability like in high end cars (think mercs and rolls royces).
A customer might have information asymmetry but isn't stupid (is this overtly harsh?).
To quote my own comment in a parallel thread here: "wouldn't a middle man who tests cars try and separate the lot and charge for his services?". The market for lemons seems model a static market which is not realistic IMHO
There is no binary system of good or bad antivirus products but a spectrum and they all have different prices. They've been put to real (viruses and malware in the wild) and synthetic tests to test their efficacy by av-test and others. So they work, maybe not 100% but more than 99% on many benchmarks.
Comparing it to a allegedly failed device like Secustick and claiming (not sure where's the evidence for it) there are no good security products and then saying it's "Because the popular commercial computer security product market is a "market for lemons":" seems like begging the question or confirmation bias or both
I'd like to hear your thoughts. I hope I'm not trying to nitpick :)
"We don't trust this code from the internet, let's run it as SYSTEM!"
Because that seems insane. It's escalating the runtime permissions of code you don't trust -- moving it from user permission to SYSTEM permission just because it hits internet cache.
I keep thinking there must be some part of this I'm missing, because if that's really how it works... "Double You Tee Eff" indeed.
On a tangential point, one common "hack" when XP was popular was to replace Winlogon.exe with Minlogon, which basically made it an ultra-fast-booting "single user mode" (and coincidentally, also bypassed WPA) and that single user was... SYSTEM. That along with EWF and some creative RAMdisk usage made for some interesting liveCD-like Windows environments.
Do you have examples for what SYSTEM can do, but Administrator cannot?
So the anti-virus runtime engine has to run as something akin to SYSTEM since it has oversight over the entire system, but once a type is detected it could pass the actual sandboxing into a lowpriv child process and wait for a result.
The only explanation I can imagine is performance? But child processes could be pre-spawned or it could use shared memory regions for isolation. There's a number of things you can do here to have your cake and eat it too.
I'm legitimately surprised by this from Microsoft, they take security very seriously these days, and I cannot see how this would pass their normal review process? Even just reading the description makes you facepalm.
And fonts come from untrusted sources of course.
So there are precedents for direct paths from untrusted sources to SYSTEM or kernel space execution environments.
I expected better from MS, I really did. This is security engineering on the level of the other AVs, Linux Desktops and similarly insecure software, i.e. no security engineering AT ALL.
Why the unnecessary jab at Linux for no reason?
Executing the JavaScript will run it in a similar way to the client, and perhaps provide the original malware which you can detect against.
Malware struggles to stay stealth due to it needing to access specific features or run specific commands to elevate or take control. That isn't true for obfustication techniques which can look and act like "legitimate" JavaScript.
WTF
Archive bomb anyone? This isn't a new concept, right?
Doing IO intensive work, e.g. build large code base, I always have to deactivate the real time monitor - it slows down the whole process, or worded differently: turning off mpengine almost half's the build time. Reading more and more horror stories about its inner workings and design, it's time to get rid of it for good.
I greatly enjoy this analogy.
Maybe I'm just wrong about that and this is a standard technique for evaluating security.
Turing's proof essentially says that there is no way to be sure of knowing what an arbitrary program will do except for running it and seeing what it does.
It's an imperfect technique for real-world programs, but so is everything. Think of it as being like static code analysis versus runtime "sanitizer" tools. Both are useful, and both can detect problems the other can't.
that's literally what every antivirus is already doing though.
Evaluating it in a sandbox, not as System, would be a reasonable attempt at security. What they are doing is insane.
Last time there were discussions about AV around here, people were adamant that Defender was simply above this type of thing - mostly based on the word of a browser vendor.
Turns out that a homogeneous AV environment is a not a good idea. Who would have thought?
That's a very broad generalization. Care to provide a citation of all AVs getting up to no good?
There's too much going on to blame this on stupidity. This has to be intentional.
I was very much prepared to blame Atlassian for this, but maybe I need to start thinking about blaming Microsoft instead, because it sounds like they've made a few bad decisions here.
(Still, if my options are this, or POSIX, I'll take this, thanks. Dear Antimalware Service Executable, please, take all of my CPUs; whatever SourceTree is doing, I can surely wait. Also, please feel free to continue to run fucking Javascript as administrator... I don't mind. It's a small price to pay if it means I don't have to think about EINTR or CLOEXEC.)
2. The forking model is seductive, but wrong-headed. It's hard to make the file descriptor inheritance behave correctly, and it means the memory requirements are unpredictable (due to the copy-on-write pages)
3. Readiness I/O is not really the right way to do things, because there are obvious race conditions, and the OS can't guarantee one thread woken per pending operation (because it has no idea which threads will do what). Also, the process owns the buffer, which really limits what the OS can do... it needs to be able to own the buffer for the duration of the entire operation for best results, so it can fill it on any ready thread, map the buffer into the driver's address space, etc.
4. Poor multithreading primitives. This really annoyed me... like, you've got a bunch of pthreads stuff, but it doesn't interact with select & co. The Linux people aren't dumb, so they give you eventfd - but there's no promise of single wakeup! NT wakes up one thread per increment, and the wakeup atomically decrements the semaphore; Linux wakes up every thread waiting on the semaphore, and they all fight over it, because there's no other option.
(I'm just ignoring POSIX semaphores entirely, because they don't let you wait on them with select/poll/etc. in the first place.)
(Perhaps this and #3 ought to be the same item, because they are related. And the end result is that you need to use non-blocking IO for everything... but the non-blocking IO is crippled, because it still has to copy out into the caller's buffer. It's just a more inconvenient programming model, for no real benefit.)
I guess it just boils down to what you want: a beautifully polished turd, or a carefully engineered system assembled from turds.
You can get Linux to only wake up one thread using epoll and either EPOLLEXCLUSIVE or EPOLLONESHOT.
Though I don't really understand why you'd want to wait on a semaphore and other waitables at the same time… probably this is just my Unix bias/lack of Windows experience showing.
Can it actually do that? For network write operations the OS has to split the data into MSS/PMTU-sized packets and add headers to it. For network read operations the OS has to reassemble the packets back into a stream or datagram, and it doesn't even know which process a packet is for until after the packet is read into memory.
You're making the copy regardless. Meanwhile IOCP requires O(n) read buffers for n sockets, instead of O(1) when the OS notifies you that it has enough packets to reassemble something.
On modern Linux OOM killer became rather good at finding the real memory offenders. Plus this unpredictability allows, for example, to transparently enable memory compression in Linux eliminating the need for swap in many configurations.
Windows kernel API documentation vs. Linux kernel API documentation... there's not even a contest to be had.
and even the kernel API documentation, which, while it has its issues, I would argue is still far better than MSDN, which IME is mostly pages and pages of function prototypes with a one-line restatement of the name of the function.
What I have done - well, what I think I have done! - the UI is appalling - is added SourceTree.exe and git.exe as exclusions. My intention here is that the antimalware service won't then monitor their activity while they're doing stuff, but will still check working copies when it does a routine scan... but sadly this didn't seem to make any difference at all, literally none whatsoever, and SourceTree continued to be what I can only describe as "slow as fuck" - if you'll forgive the technical jargon.
The odd thing is, though, which just occurred to me like literally right now, it might actually be safer to add the folder exclusion after all! Because then there's zero risk of the Javascript interpreter springing into action :-|
What a time to be alive!
(But I still stand by everything I said about POSIX.)
At this point I've memorized the keys to hit to quickly disable and re-enable defender's real time protection (winkey > "defen" > enter > tab > (down to disable, up to enable) > alt + F4)
https://blog.sourcetreeapp.com/2017/04/27/sourcetree-for-win...
(new Error()).toString.call({message: 0x41414141 >> 1})
It's hard to imagine MS doesn't receive tons of watson crash reports of MsMpEng from trying to run bits of random JS. If they haven't looked at them, they probably should start now.
The attached proof of concept demonstrates this, but please be aware that downloading it will immediately crash MsMpEng in its default configuration and possibly destabilize your system. Extra care should be taken sharing this report with other Windows users via Exchange, or web services based on IIS, and so on.
And I think the intended formulation was "care should be taken sharing this report with other Windows users or via Exchange, or web services based on IIS..." (because they're afraid it could crash the servers even if sharing between non-Windows users!)
I met someone who worked on Office. He told me there were parts of Excel that used a shared code base for Mac/Win/Web, parts that were just Mac/Web with different Win components, and for the Excel graphs, the labels for the graphs were unified for all three platforms but drawing the graph was individual to each platform. Mac Office was a fork from years ago they're finally trying to rebase and bring back into mainline.
Some large companies aren't really unified entities with universal standards. You can be using a standard unified approach for the company and still be seated next to an intern not forced to use version control or a brand new Uni hire that's on a totally different process due to the team they get hired into.
https://msdn.microsoft.com/en-us/library/ee823878(v=cs.20).a...
https://technet.microsoft.com/en-us/library/security/4022344
Simply lists: "Verify that the update is installed
Customers should verify that the latest version of the Microsoft Malware Protection Engine and definition updates are being actively downloaded and installed for their Microsoft antimalware products.
For more information on how to verify the version number for the Microsoft Malware Protection Engine that your software is currently using, see the section, "Verifying Update Installation", in Microsoft Knowledge Base Article 2510781.
For affected software, verify that the Microsoft Malware Protection Engine version is 1.1.10701.0 or later."
As far as I can figure out, if:
Get-MpComputerStatus|where -Property AMEngineVersion -ge [version]1.1.10701.0|select AMEngineVersion
prints something like:
AMEngineVersion
---------------
1.1.13704.0
according to MS one should be patched-up and good to go? (The command should print nothing on vulnerable systems).However a hyper-vm last patched before Christmas (it's not networked), lists it's version as: 1.1.12805.0 -- which certainly seems to be a higher version than 1.1.10701.0?
I'll also note that using "[version]x.y.z.a" apparently does not force some kind of magic "version compare"-predicate, based on some simple tests.
Any powershell gurus that'd care to share a one-liner to check if one has the relevant patches installed?
Am I looking at the wrong property?
# On old hyper-v vm:
Get-MpComputerStatus \
|where -Property AMEngineVersion \
-gt [version]1.1.13701.0 \
|select AMEngineVersion
AMEngineVersion
---------------
1.1.12805.0
I guess one out of two isn't bad...Microsoft Forefront Endpoint Protection 2010
Microsoft Endpoint Protection
Microsoft Forefront Security for SharePoint Service Pack 3
Microsoft System Center Endpoint Protection
Microsoft Security Essentials
Windows Defender for Windows 7
Windows Defender for Windows 8.1
Windows Defender for Windows RT 8.1
Windows Defender for Windows 10, Windows 10 1511, Windows 10 1607, Windows Server 2016, Windows 10 1703
Windows Intune Endpoint Protection
Last version of the Microsoft Malware Protection Engine affected by this vulnerability Version 1.1.13701.0
First version of the Microsoft Malware Protection Engine with this vulnerability addressed Version 1.1.13704.0
https://technet.microsoft.com/en-us/library/security/4022344
If GNU/Linux had a market share of >50%, I would expect similar news to pile up at a comparable rate.
For the moment, GNU/Linux enjoys kind of a reverse herd immunity, but I do not believe it is inherently more secure than Windows.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender]
"DisableAntiSpyware"=dword:00000001
Then reboot.On the other hand: Microsoft has already issued a fix: https://twitter.com/msftsecresponse/status/86173436019355238...
But still; the auto-unpack of archives leaves me wanting to just disable it completely.
Surely not - what happens if you feed it the zipfile quine?
However... suppose someone crafted an alternating version -- where A.zip contains B.zip contains A.zip etc. -- I bet there are systems out there which only do one tier of checking.
for level = 1 to arbitrary_depth:
do_some_work_which_may_produce_more_work()
You just have to select arbitrary_depth large enough that nobody notices and there you have it - arbitrarily deep recursion without infinite loop ;)Totally wouldn't be surprised if MS did it this way too. Otherwise you are right - they would need to remember at least hashes of all "outer" archives unpacked so far.
I actually did this recently for a random phone number generator, using the phony Ruby library to validate numbers. It was just for some test fixtures, but it's nice to know that it will always fallback to a default test number in case something goes wrong and it runs out of attempts. Or I'm in some universe where my random number generator suddenly starts producing an endless stream of zero bits.
This is just a little 'tick'. I also find myself using 12px and 14px a lot more frequently than 13px.
... So it really needs to be semi-random :p
The idea of a zip-quine and how it interacts with poorly-designed malware detection offers so many interesting hypothetical variations.
It seems that Google is eager for someone to use this exploit to attack as many systems as possible before they can be patched against it.
1. Execute NScript, a JavaScript-like language.
2. Run as high privileged, non-sandboxed process.
3. Intercept filesystem changes and run NScript code written to anywhere, including browser cache.
4. Do not check code signing.
This is unbelievably ridiculous. It shall not happen to the software which claims to improve "security".
As I always said, there is no good anti malware software. Everything sucks.
An additional software is an additional security risk.
It's the name of the component.
This one is really bad, of course, but historically, it's not the worst.
Exploitability Assessment for Older Software Release: 2 - Exploitation Less Likely
Anyone with ideas on how they came to this conclusion? Yes, I read the linked document but felt that the index assessment didn't really reflect that google (Natalie?) seems to have found this "in the wild".
>the index assessment didn't really reflect that google (Natalie?) seems to have found this "in the wild".
Did she? How do you know this?
edit: MS seems to explicitly say they are not aware of it being used. "Microsoft had not received any information to indicate that this vulnerability had been publicly used to attack customers when this security advisory was originally issued."
Left column says: Finder-natashenka
twitter.com/natashenka -> Natalie
I added a "seems" since I wasn't sure, but let me use it again: there sure seems to be a connection.
Edit: Control Flow Guard. So software which is compiled with this specific flag in VS 2015+ isn't affected.
That seems vague and unlikely to be very common.
for the purposes of mitigating the vulnerability in msmpengine, what matters is that msmpengine has cfg enabled. whether other arbitrary programs on your computer have it too is not relevant to this story.
cfg works like this: when a process has cfg enabled, the windows kernel will maintain a list of all valid indirect call targets for it, and then validates all indirect calls against this list. if validation fails (because the process attempted a call to an invalid target), the kernel terminates the process.
obviously, this requires kernel cooperation. this was introduced in windows 8.1, which means windows defender on windows 7 can't use cfg there.
cfg raises the bar a little in making it harder to obtain remote code execution from simple memory corruption, but doesn't make it impossible.
Not necessarily
if you read this, could you tell to Microsoft for fix the issue with definition updates that won't remove after update? The definition kept growing and waste space. (the problem auto solve if the computer is rebooted).
Thanks :)
$ /cygdrive/c/Program\ Files/Windows\ Defender/MpCmdRun.exe /h Windows Defender Command Line Utility (c)2006-2008 Microsoft Corp Use this tool to automate and troubleshoot Windows Defender
[...]
<code> $ /cygdrive/c/Program\ Files/Windows\ Defender/MpCmdRun.exe /h Windows Defender Command Line Utility (c)2006-2008 Microsoft Corp Use this tool to automate and troubleshoot Windows Defender </code>
https://news.ycombinator.com/item?id=12184173
Despite getting all the downvotes, who is looking stupid now?