What the hack happened in 2017?
By- December 24, 2017
Cybersecurity got a lot of public attention this year mostly thanks to some very notable breaches that impacted not just individuals and corporations, but also governments (subsequently affecting infrastructure and defense)!
In 2017, we saw an array of ransomware, malware, data breaches and leaks galore. Some of these you will have no doubt heard about, but there were many that flew under the mainstream radar. Here is a list highlighting some of the most notable cybersecurity attacks from this year, in our “12 days of hacking, what my blackhat gave to me” … come on, tis’ the season for holiday puns!
1) Equifax: the credit reporting agency Equifax had a major data breach that allowed hackers to obtain upwards of 145 million of their customers’ personal data, including social security numbers, dates of birth and home addresses.
2) WannaCry: a ransomware cryptoworm encrypted data on approximately 230,000 computers running on Microsoft Windows in over 150 countries, demanding ransom payments in the Bitcoin cryptocurrency. The US and UK governments have stated that North Korea was to blame for these attacks.
3) US National Security Agency (NSA): a virtual disk image owned by a division of the NSA, containing over 100 gigabytes of data from an Army intelligence project, codenamed "Red Disk," was leaked revealing a surveillance program pointed at domestic interests named “Ragtime” that targeted Americans.
4) US Central Intelligence Agency (CIA): WikiLeaks gained access to sensitive “classified” and “top secret” documents, detailing the agency’s intentions to hack into iPhones and Android devices, as well as smart TVs.
5) Cloudbleed: Tavis Ormandy from Google’s Project Zero discovered and reported a security problem with Cloudflare’s edge servers. He was seeing corrupted web pages being returned by some HTTP requests run through Cloudflare, resulting in customer data leaks from Uber, 1Password, Tinder, and online dating site OKCupid, among others.
6) Sabre Systems: a reservation software company, had over 32,0000 of their hotels and other lodging establishments hacked for access to their payment and customer data tied to bookings processed through a reservations system. Other major companies that had data stolen by the breach include Google, Hard Rock Hotels, and Loews.
7) School’s Out: A hacker identified as Rasputin breached and leaked data from several universities and government agencies, including NYU, Oxford, Cambridge, and the US National Oceanic and Atmospheric Administration using SQL injection.
8) NotPetya/Petya/Nyetya/Goldeneye: A computer virus referred to as NotPetya targeted Ukrainian businesses using compromised tax software affecting major global businesses, such as FedEx, but hitting Ukrainian infrastructure particularly hard. It disrupted utilities like power companies, airports, public transit, and the central bank; just the latest in a series of cyber assaults against the country.
9) Bad Rabbit: Most of us know pop-ups should not be trusted, but a major ransomware campaign, referred to as Bad Rabbit, managed to sneak into computers through an Adobe Flash installer. It was placed on compromised news and media websites. This ransomware mostly affected Russia, but experts saw also saw cases in Ukraine, Turkey and Germany.
10) Virgin Airlines: After Alaska Airlines acquired Virgin America, an unknown hacker broke into Virgin America's corporate network compromising 3,120 employees and contractors logins, while 110 additional employees may have had personal information stolen.
11) Uber: It came to light this year that hackers infiltrated Uber and were able to steal data from 58 million of Uber’s customers. Uber responded by forking out $10 million to pay off the hackers and try to cover it all up.
12) GOP Voters: Almost 200 million voter records were exposed online after a GOP data firm misconfigured a security setting in its Amazon cloud storage service. This became an alarming pattern for breaches stemming from insecure Amazon servers where data is stored. Other companies whose data was also exposed and leaked on Amazon servers include Verizon, Accenture, Viacom, and the U.S. Department of Defense.
Tinfoil Security genuinely believes there are more good folks out there vs. bad, so we have hope and look forward to bringing joy to the world of cybersecurity in 2018 and beyond!
Strutshock: Apache Struts 2 (RCE CVE-2017-5638) in Plain English
By- November 07, 2017
If you’ve paid attention to the news recently, you’ve certainly heard about the massive breach at Equifax, now estimated to have put 145 million of people’s sensitive personal data out into the world. You’ve probably also heard it was due to unpatched software. So what was the issue, why does it matter, and what can you do? Let’s start with the basics.
In vulnerable versions of Struts 2, there is a bug in how errors are handled when the server receives a request containing a Content-Type, Content-Length, or Content-Disposition header. With an unexpected or malformed request, you would expect the server to send back a 400 error, or otherwise ignore the request. However, with a vulnerable version of struts2, the Jakarta Multipart Parser will parse that header string and, if it contains executable OGNL code, execute it. What, then, is OGNL and why would it matter if it parses and executes some code? OGNL, or Object Graph Navigation Language, is a Java library which, on the development side, provides convenient tools for getting and setting values on Java objects. For instance, connecting the forms on your web page to the struts representation of that data on the server. Being able to inject commands through OGNL means an attacker can then substitute values on the server such that it will run whatever malicious code the attacker wishes to send.
Short version: malicious Content-Type/Length/etc. header -> Jakarta Multipart parser error -> OGNL receives the header as executable code -> server now runs malicious code as if it were part of the original program. So if we have a site we think is vulnerable, we could set up a script that will send one of these headers that spawns a bash shell and takes a command from the user. Have a look at the video for a quick demo.
As you can see, this gives us quite a bit of power over the system. We can traverse through directories, create files, view environment variables (which in turn gives us access to the database), and even cause the site to crash by deleting necessary files.
If a server is running a vulnerable version of Struts 2, an attacker who knows how to exploit this might as well have your server running locally on their computer. They can access the source code of your site. If your site has access to a database, so do they. If they want to tell your server to sleep, putting you out of business for a while, they can. Even if your server has limited privileges, or the site runs on a virtual machine, the attacker might be able to learn something about where your sensitive data actually lives that could be leveraged to launch an attack where it will cause the most harm.
You probably hear it all the time, but keep your software up to date. Test your production code and make sure you’re able to roll out the most up to date versions of the libraries and technologies you rely upon as quickly as you can once they are available. The fix to this vulnerability is available in Struts 2 versions 126.96.36.199 or 2.3.32 and later, both of which have been available since March. For note, the Equifax breach happened at the end of July, well after the tools were available to fix the vulnerability in question. Applying the patch is simpler than trying to roll your own header validation and far quicker.
If you don’t know if you’re vulnerable, or if you think you’ve set up an effective solution, you can check using our free service here. If you’re already using our web scanner product, you’re already being checked for the Strutshock vulnerability in your scans, along with many other common vulnerabilities. Thanks for reading, and stay secure.
Creating Testable, Modularized Chrome Extensions
By- April 11, 2017
When creating software, it’s very important to be able to verify the correctness of your code, and writing a Chrome extension is no exception. For an automated testing suite to work, we require two things. First, the code must be modularized in a way that allows for simple unit tests to be written. If this isn’t the case, writing tests can become a very tedious and messy process. Second, the testing suite needs to be able to access and interact with the application as a whole (integration tests). At first glance, it appears Google Chrome’s extensions satisfy neither of these requirements. However, with a bit of creativity, we can find solutions to both.
How Chrome Makes Testing Hard
We’ll begin by looking at the first requirement: The code must be modularized in a way that allows for simple unit tests to be written. Chrome extensions are broken into three parts. The popup (the window that shows when you click the extension icon), the background script (any extension logic that runs in the background), and the content script (any extension logic that runs as a part of the current web page). Each of these must be exactly one file.
We’ll discuss a few solutions soon, including how Google likely manages their 26,000-line background script, but for now let’s move on to the second requirement: The testing suite needs to be able to access and interact with the application as a whole. The good news is that Google provides ChromeDriver, a way of programmatically interacting with Chrome. The bad news is that they seem to have forgotten about programmatically interacting with extensions.
As of today, there isn’t a way to click on your extension’s icon and open the popup using ChromeDriver. The workaround is to navigate to http://(your extension id)/popup.html, and view your popup there. This workaround is flawed, however. It renders the popup in a differently sized window than your normal popup, which makes asserting on UI behavior challenging or impossible depending on what you want to do. Also, if you want to assert that interacting with your popup does something to a page that’s currently open, you’re out of luck, since you need to navigate your browser to the popup to be able to interact with it.
How We Can Test Chrome Extensions
Creating a Chrome extension that’s testable is possible, but we need to get a bit creative. To begin, we need a way to modularize our program into bite-sized chunks that each have a specific purpose. Then, we need to figure out a solution to our integration test issues, including setting up some sort of headless browser that can run tests. Finally, we need to actually write tests.
The other option is to use some sort of build system. By using a build system (such as Gulp), you can develop the extension in any form you’d like, then allow the build system to concatenate files together, thus creating Chrome’s required single script at build-time. By using a task runner like Gulp, you could have a setup where Gulp runs unit tests on your modules, then minifies and compiles everything into Chrome’s required format, and finally runs integration tests on the bundled package. This solution requires Node as a development dependency, but it offers more flexibility than the background.html option.
Writing functional integration tests is a little harder. Assuming we want to use some sort of CI system, we’ll probably want our integration tests running in a headless browser, so we should first focus on trying to get a headless browser running with our Chrome extension.
Selenium is a popular choice for browser automation, and has wrappers in just about every major language. It also works with ChromeDriver, which is great news, since we can’t load our Chrome extension into any other kind of browser. Depending on your wrapper, you’ll either be given a method to load in an extension or you’ll have to use the driver flag
--load-extension=extension_path. If you’re running the browser in headless mode, it may also be required to pass
The extension path you give the driver should be the path to the folder containing your manifest.json, and it should not be zipped. If either of these aren’t true, Chrome crashes. Once you’ve gotten Selenium to navigate to your extension popup at http://(your extension id)/popup.html, you’re ready to put together some tests.
Actually Writing Tests
A Working Example
I’ve put together a working, testable example implementing everything mentioned in this blog post. It can be found on GitHub here. This can be used either as a proof of concept or as a base for anyone writing a Chrome extension. The extension has a super simple background module that we test with a unit test, and some text on a popup that we test using an integration test. Unit tests are done using Karma and Jasmine. Integration tests are done using Watir and RSpec. Hopefully this example helps people write better, more testable Chrome extensions in the future.
Questions? Have a better method for testing Chrome extensions? We’d love to hear from you. Feel free to shoot us an email at email@example.com with any awesome browser extensions you’re building and how you’ve gone about testing them.
Announcing Tinfoil Security's Login Recorder
By- April 03, 2017
Ensuring our scanner can successfully authenticate into any given site has always been a priority at Tinfoil Security, and has helped us stay ahead. After all, if authentication fails, the scanner may not be able to access huge parts of a site, and can miss many vulnerabilities. Today, we’re announcing the Tinfoil Security Login Recorder: the easiest way for our scanner to authenticate into your site.
The Login Recorder is a browser extension that allows you to teach our scanner how to authenticate into your site by recording your login sequence in your own browser. Simply install our Chrome extension and follow the on-screen instructions to submit your recording.
Begin by providing API keys found here. If you’ve never created Tinfoil API keys before, the first step in the extension has a link to an interactive tutorial that will show you how to make one. Ensure your keys are “Full Access”, otherwise the extension won’t be able to send data to our server.
After you’ve authenticated, you’ll be asked to select which site you want to provide a recording for. Choose the site from the menu then hit ‘Next’. You’ll be warned about which sites have existing recordings, and submitting a recording for a site that already has one will overwrite the existing recording.
When a site has been selected, you’re ready to record! Make sure you’re on the login page for the correct site, then hit the ‘Record’ button.
At this point, the extension icon will turn red to indicate we are recording. Authenticate with your site as you normally would, then open the extension popup and click ‘Finished’ to end your recording.
Next, you’ll be asked to select some ‘verifiers’ on the page after you’ve logged in by clicking on them in your browser. A verifier is an element on the current page that is not present before authentication. For example, if you authenticate with your site and are greeted with a “Hello, Nathaniel!” banner, this would make a perfect verifier. We use these verifiers to help figure out if our scanner successfully logged in to your site, or if something went wrong in the process. We recommend selecting at least 3 verifiers.
When this is done, all that’s left to do is submit! Once you hit the ‘Submit’ button, your recording will be securely sent to our servers, and your next Tinfoil scan will mimic your recorded login to authenticate into your site.
This new method of authentication will work on many different types of login flows. Whether your site uses a traditional style login page, or a complex multi-page authentication flow built to your site’s needs, the Login Recorder provides a simple way to get your account setup quickly and easily.
Note that Tinfoil Security is dedicated to handling your sensitive information privately and securely. After submitting, your recording and API keys are removed from your system. On Tinfoil’s servers, your recording is encrypted using the same security practices as the rest of Tinfoil Security’s sensitive information. See https://www.tinfoilsecurity.com/security for more information.
Visit the Chrome Web Store to try the extension today!
Strutshock: Apache Struts 2 Remote Code Execution
By- March 10, 2017
NOTE: Tinfoil’s web application scanner now looks for Strutshock! Sign up and start a free trial here. We also have a checker for only Strutshock here. Simply input your URL to see if you are vulnerable.
If you’ve been keeping up with the security community lately, you’ve probably heard about the Struts 2 vulnerability (CVE-2017-5638) announced by Apache a couple days ago. This allows for remote code execution due to improper handling of the Content-Type header by the Jakarta Multipart parser. Thus, an attacker can gain full access to and control of any information stored on a server.
How is this being exploited?
When an invalid Content-Type header is parsed by the Jakarta Multipart Parser, an exception is raised. The raised exception includes the invalid Content-Type header in the message. Unfortunately, if the header includes OGNL (Object Graph Navigation Language), the OGNL is evaluated before being returned. This allows an attacker to execute arbitrary code in the exception handler.
Who is affected?
Anyone currently using Apache Struts 2.3.5 - Struts 2.3.31 or Apache Struts 2.5 - Struts 2.5.10. If you’re not sure whether or not you’ve been affected, we’ve included our Strutshock test, for anyone, as part of our free trial once you’ve verified ownership of your website.
What should I upgrade to?
Upgrade to Apache Struts 2.3.32 or Apache Struts 188.8.131.52.
I can’t upgrade right now, is there a workaround?
Yes, two workarounds were recently published on the Apache Struts 2 documentation. However, we highly suggest upgrading to a patched version as soon as possible.
Why was there an increase in attacks after the patch?
When the patch was released on March 6, less than a day later, a GitHub issue was opened on Rapid7’s Metasploit framework, an open source project, that included sample code allowing anyone to exploit the vulnerability. According to Cisco Talos, this resulted in immediate exploitation, and the rate of exploitation has remained steady since. If the severity doesn’t worry you, the fact that this attack is easy to reproduce and incredibly widespread should.