Friday, November 23, 2018

What have I been doing these last few years?

I've been relatively quiet on this blog since I started working at Riot Games in 2013 in part because my day job has been more on the game development side than the security side so there haven't been a lot of security topics worth writing about. I thought since it has been five years now I'd do a round up now that I have a few years of bits and pieces that have some security crossover!

When I started at Riot I worked on the infosec team on a variety of things (primarily incident response and bug bounty) here's some of the cool work that team did:

Running a Bug Bounty Program - Blog post about Riot's approach to bug bounties
The Evolution of Security at Riot - Overview of Riot's infosec program
Cloud Inquisitor  - Security monitoring and policy enforcement tool for AWS (open source)

After I left Riot infosec I moved onto League of Legends where I worked on cheat detection and prevention systems as well as some networking and metrics collection changes. I wrote code that was deployed to hundreds of millions of computers and eventually led to some of things described in these articles:

Removing Cheaters From LoL - Player facing overview of Riot's anti-cheat activities
Riot's Approach to Anti-cheat - A good overview of Riot's anti-cheat strategies and tech
Riot Games wins $10 million in LeagueSharp suit - A tech and legal battle I influenced
Riot’s anti-cheat team just took down a huge scripting provider - Another battle for the team

Eventually I left League of Legends and its anti-cheat team behind. I entrusted it to the extra-ordinarily talented Nemi and Michael who by day build great anti-cheat systems and by night run the blog

In particular check out these great posts from them:
Spurious #DB exceptions with the "MOV SS" and "POP SS" instructions (CVE-2018-8897)
Enumerating process, thread, and image load notification callback routines in Windows
Detecting debuggers by abusing a bad assumption within Windows

So if I haven't been working on League of Legends what have I been doing? I've been exploring game development (and a helping of security/anti-cheat work) for on a new game at Riot, it's a project that I'm super excited about but one that's not ready for the limelight. There's a good chance my next blog post here will be pointing you all at the project so stay tuned!

Sunday, September 27, 2015

KPROCESS - InstrumentationCallback - Get callbacks on return from kernel mode

Long time no see everybody!

I was pointed at a really interesting article this week and thought I'd share.

It turns out in Windows Vista x64 and later you can ask the kernel to invoke a callback on transition out of kernel mode. KPROCESS has a field called InstrumentationCallback that you can set with a call to NtSetInformationProcess with a ProcessInfoClass of 0x28 and a InputBuffer that contains the pointer to your callback.


  • User mode only, no driver or kernel debugger required
  • Affects the entire process (including injected threads)


  • Windows x64 only
  • Apparently doesn't work on WOW64 (though maybe some jiggery-pokery could get it done)
  • Required Dr7 to be set in most cases so not great at catching malicious actors

The original article: Windows x64 system service hooks and advanced debugging and check out the author's blog for other interesting RE posts.

Tuesday, November 5, 2013

Authenticode and Antivirus Detection Revisited

It's time to revisit code signing and antivirus detection! Two years ago I looked into whether or not Authenticode signatures (Microsoft object code signing for PE files) influenced the decisions of antivirus engines.

In the first part I described the process of finding, signing and testing some malware with VirusTotal and it appeared that adding an Authenticode signature to a known piece of malware drastically lowered its detection rate. After an astute observation in the comments and some thinking about it, I decided this was more likely due to the fragility of the signatures created by antivirus vendors. In the second part I test this theory by using the VirusTotal API to test 100 malware samples to compare the response of adding an Authenticode signature to changing the binary in other ways. The result largely confirmed that rather than code signing that was defeating the antivirus scans, it was that the binary was changing at all.

These results were ultimately unsatisfying, partly because of the surprising fragility of the antivirus signatures but also because of the test methodology. VirusTotal is a wonderful resource but is only testing the core antivirus engine of these security products which these days is only a small part of the protective services provided by security software. Additionally, the certificate that the malware was signed with was not endorsed by any certificate authority and was not deemed trusted by the operating system.

This time around I investigated how the actual security products responded, and used a trusted certificated to sign the malware. Unlike last time, the number of engines tested is much lower and the number of samples used is only one. Turns out that this kind of testing is very time intensive if you don't already have the infrastructure set up. While I did have some free time during the US Government shutdown while waiting for a US visa, there's a limit to how many virtual machines I felt like setting up.

Part 1 - The Malware
This time the malware sample used is VPN-Pro.exe (MD5: 8eda7dfa4ec4ac975bb12d2a3186bbeb) as contributed by the redoubtable @headhntr to the Syrian Malware Samples Project. As described by the Citizenlab analysis it is a trojanized version of Freegate 7.35 written using .NET 3.5 that drops the ShadowTech RAT. The campaign was targeted at dissidents in Syria, make sure that you check out the analysis, it's fascinating but a little outside the scope of this post.

When Citizenlab submitted VPN-Pro.exe to VirusTotal in June 2013 it was detected by 5/46 antivirus engines. When I checked in October the VirusTotal report had been updated to show detection by 34/47 antivirus engines.

Part 2 - The Antivirus Suites
The test environment is a series of Windows 8.1 Virtual Machines with the following security software suites installed.

  • Sophos Endpoint Client Protection
  • McAfee All Access
  • Norton 360
  • Windows Defender (as installed by default with Windows 8.1)
In addition Chrome was installed in each VM, and each sample was submitted to VirusTotal.

Part 3 - The Transformations
Six versions of the sample were tested, the original and five transformed versions.

1. Padded
VPN-Pro.exe with 1024 'A' characters appended to the end.

2. Random Padding
VPN-Pro.exe with random bytes added to match the length of the signed version.

3. Authenticode (Self-signed certificate)
VPN-Pro.exe signed with a test certificate (as describe in part 1 of this series)

4. Damaged Authenticode (Self-signed certificate)
VPN-Pro.exe as prepared in number 3 but with roughly 10% of the signature bytes replaced randomly.

5. Authenticode (Trusted certificate)
VPN-Pro.exe signed with a trusted code signing certificate from (thanks to the anonymous benefactor that helped me with this part).

Part 4 - The Method
Each VM had the trial version (as found on the vendor's website) of the security software installed. Windows and the security software were then updated. Next Chrome was used to download each sample and the reactions of the browser and security software were recorded. If there was no reaction from the security software or browser a manual scan was initiated where possible. In the case of Windows Defender the same tests were undertaken using Internet Explorer as well as Chrome.

Part 5 - The Results

OriginalPaddedRandom PaddingDamaged SignatureSelf SignedTrusted Signature
McAfee All Access
Norton 360
Sophos Endpoint
Windows DefenderMild Warn
Virus Total34/477/477/467/477/478/47
Nothing detected
Warning, this may harm your PC
Reputation based detection
Explicitly marked as virus

McAfee All Access

The original sample was detected as malware and automatically removed.

All other samples were detected as malware and quarantined.

Considering that on the VirusTotal scan McAfee did not detect any of the transformed samples, my guess is that the Quarantined dialog is shown on heuristic or binary reputation based matches while the automated removal dialog is for signature based matches.

Norton 360

The original sample was detected as malware and automatically removed.

The transformed samples were also all detected and automatically removed.
The difference being that all the transformed files were detected as the threat "WS.Reputation.1" and the Threat Type of "Insight Network Threat". This suggests to me that the cloud binary reputation service is flagging these files as harmful largely because they have note been seen before. Again, the Symantec engine did not detect the transformed files during the VirusTotal submission (I assume that Norton 360 uses the Symantec antivirus engine).

Sophos Client Endpoint Protection

Again, the original sample was detected and removed.

In fact all the transformations (except one) of VPN-Pro.exe were detected in the same way as the original and were tagged as Mal/Generic-S. The original was flagged as Mal/Generic-S on VirusTotal as well but the transformations weren't likewise flagged at the time, unsure whether this is due to some fuzzy matching or updated signatures.

However, the Authenticode version with the trusted certificate was downloaded without complaint. Considering that the self signed version was flagged as malicious, I'm drawn to conclude that the validity of the signature was taken into account.

A manual scan was run after the initial download completed.

Windows Defender

Windows Defender on Internet Explorer gave the largest variety of messages, here's all six:

Like all the other security suites, the original was flagged as a virus and removed. What happens with the transformed versions is rather more interesting. Firstly the padded version was still detected as a virus, while the randomly padded one wasn't (the random padding was longer than the non-random padding). Unique to IE the damaged signature transformation was reported as a 'corrupt or invalid' signature and treated differently to the random padding transformation. The self-signed Authenticode transformation was flagged as "not commonly downloaded" rather than a virus, and the the trusted certificate Authenticode transformation was flagged the same way but with a yellow bar rather than a red one.

The diversity of messages here was surprising, clearly the signature of the file is being examined and being combined with some cloud based binary reputation system (Smartscreen filter?) before a determination is given to the user. It's worth noting that a non-malicious, unsigned, uncommon binary gave the same message as the signed (untrusted) executable and that a non-malicious, unsigned, common binary (putty.exe) gave no warning message. This means that the malicious, signed binary landed somewhere in between these two cases.

Part 6 - Conclusion
First a caveat: with only a single malware sample and a small handful of security suites we can not come to any sweeping conclusions.

However, it looks like Windows Defender / Internet Explorer as well as Sophos take into account Authenticode signatures when scanning executables. All tested security suites seem to have very fragile signature driven engines that were defeated by almost any change to the sample but these systems are backed up by heuristic systems that are at least partially powered by a cloud based binary reputation mechanism. Windows Defender and Sophos both differentiated between untrusted Authenticode signatures and trusted signatures and Windows Defender differentiated between Authenticode signatures, a corrupted Authenticode signature, and arbitrary appended data.

A Change!

Hey everyone, just dropping in to tell you that I'm moving from Google to Riot Games. I've loved my time at Google but I'm really excited to be able to work on security in the context of online games (also I'm a huge fan of League of Legends). I'll still be blogging (possibly more so than before) and as always the views on this blog represent my opinions and not that of my employer.

Stay tuned for a new blog post very soon now, I have some notes compiled that I just have to polish.

Friday, January 18, 2013

Hardcode 2013 Starts Today!

Hardcode 2013, Google and Syscan's secure coding competition, has started! The contest information has been posted at

From the description:
Teams must develop a marketplace web application that allows people to organize bartering of academic goods or services in a school setting (e.g., selling used books, supplies, tutoring services). The Application should support a general marketplace where any Seller can post an Item they want to sell and any Buyer can express interest in or bid on an item. This Application does NOT include a payment transaction system; the Application connects potential Buyers with Sellers but does not perform actual payment transactions.
If you're a student take a look!

Thursday, January 10, 2013

Hardcode: Google and Syscan's secure coding competition

Google and Syscan are running a secure coding competition with sizable cash prizes. Teams of students  will build web applications of App Engine that will be judged on their features and overall security.

Original post:

Saturday, November 17, 2012

TextHole Source Code

A quick update.
 The source code to TextHole is now available from my github account

Monday, November 5, 2012

Tavis Ormandy's (second) Sophail paper

Tavis has done it again with another paper about the failings of Sophos. This time with several interesting bugs and a working exploit.

Sophail: Applied attacks against Sophos Antivirus

Full Disclosure Post (including link to exploit):
[Full-disclosure] multiple critical vulnerabilities in sophos products

Saturday, September 15, 2012


To experiment with Google Appengine I've created a simple text repository application called TextHole.

TextHole is a basic text repository with the following features:

  • Anonymous uploads and read access
  • Optional Google OAuth2 authentication to allow you to delete or edit your uploads
  • A simple JSON interface makes it easy to post and download text from other sites
To download text via JSON make a GET request to[mesage_id]
The reply will be a JSON dictionary with the following keys:

body: the text body of the message
editable: whether the requestor can modify the text
creation: Creation time of the text
expiry: unix timestamp of the expiry of the text
message_id: the message id of this text
status: True if the request succeeded
error: If status is false more details here

Note: Only status and message_id fields are guaranteed

To upload text via JSON make a POST request to providing a JSON dictionary via the data form field. 

Possible actions are:
New message: The body key is required
Delete: The delete key is required
Edit message: The body and overwrite keys are required

Request dictionary keys:
body: the text body of the new/modified message
delete: the message id of the message to delete
overwrite: the message id of the message to edit
authenticated: if set attribute the new message to the user
expiry: number of seconds (max 1yr) the text is to be valid for

Notes: One of body and delete is required. Overwrite and delete require a valid cookie to be sent with the request.

Reply dictionary keys: 
message_id: the message id of the new/edited/deleted text
status: True if the request succeeded
error: If status is false more details here
expiry: unix timestamp of the expiry of the text
user: username of the owner of the text ("None" for anonymous)

TextHole is missing the following features (maybe coming soon):
  • An index of available texts
  • Text search
  • A javascript client library to make it even easier to integrate with TextHole
  • A way to authenticate via the JSON library
Please play around with TextHole and send me any bugs or ideas that you find. Please remember that everything in TextHole is public, I can see it, and so can everyone else. Finally, please don't use TextHole for evil.

Friday, September 7, 2012

Google acquires VirusTotal

VirusTotal, the online service that will scan uploaded files against dozens of AV engines has been acquired by Google. Here's the announcement. I think this is great, I'm a big fan of VirusTotal and I am looking forward to what Google and VT can come up with together.