Welcome!

Blog Feed Post

PHP 7 Vulnerabilities You Can’t Ignore

Since its initial release in December 2015, PHP 7 has earned praise by early adopters for its new language features and impressive performance improvements. But developers beware: Glaring security holes lurk beneath the glamour of a new release. In late December 2016, security researchers discovered multiple zero-day exploits in PHP 7, including remote code execution and denial of service vulnerabilities. Attackers can use these exploits to take your site offline or worse—hijack your site for all manner of dastardly deeds.

While the latest PHP 7 releases include patches for these vulnerabilities, the Common Vulnerabilities and Exposures (CVE) List shows that security researchers regularly discover PHP security flaws. In this post you will learn how security breaches can impact your business and what you can do to protect your PHP applications from hackers.

 

Now that we understand the consequences of a security breach, let’s take a closer look at the zero-day exploits discovered in PHP late last year.

Use unserialize()with extreme caution!

The common denominator among all three exploits is PHP’s unserialize() function. PHP 7 introduced a new filtered unserialize feature that aims to mitigate the impact of code injection vulnerabilities by requiring developers to whitelist classes that are safe to unserialize. But even with this improvement, passing untrusted input to unserialize() is not safe, as clearly indicated by the function’s documentation. 

What is untrusted input?

Any input that comes from a source not directly under your control should be considered dangerous. Examples of input sources include query string parameters, HTML forms, file uploads, third-party APIs, and more.

Is my site vulnerable?

The only way to know if your site is vulnerable is to inspect your entire codebase and all of its dependencies. Typically the vulnerability report, such as this one for CVE-2016-7479, includes enough information for you to identify vulnerable code. However, each vulnerability is unique, making it unfeasible to manually inspect your codebase for every possible vulnerability—not to mention you have to repeat these inspections every time you change your code or new vulnerabilities are discovered.

How do I fix it?

The immediate fix is to update to the latest patched version of PHP 7. If that’s not possible because you are using shared hosting or because upgrading could break your application, you need to implement a workaround. Even if you can upgrade PHP, you should still consider a workaround because unserialize() is historically risky and likely still contains undiscovered vulnerabilities. In this case, the safest approach is to use an alternative serialization format, such as JSON, that can deserialize data without loading or executing additional PHP code. 

Building a foundation for PHP security

At this point your head may be spinning—and we’ve only covered a single PHP 7 vulnerability. Fortunately, there are many industry standard tools and practices available to help you make your site more secure without losing sleep or breaking the bank. Even adhering to only two or three of these recommendations will put you in a more secure posture than many organizations.

Patching schedule

This one isn’t PHP specific, but if you don’t keep your operating system and PHP version up to date with the latest security patches, nothing else you do matters. Most Linux distributions include PHP in their package repository, and they update it regularly with the latest security patches. Enabling automatic security updates for your OS is the absolute minimum you can do. If you install PHP from source or some other method, you should use configuration management software such as Ansible, Chef, or Puppet to automate the installation and upgrade process.

Dependency checks

Most production PHP applications depend on dozens of third-party libraries directly, and even more libraries indirectly. Each one of these components may have security flaws and require regular updates. For this reason, many development teams use Composer to simplify management of their app’s dependencies. But how do you know when you need to update?

 The open source OWASP dependency-check tool can identify vulnerable Composer packages in your application. As a bonus, if you use NPM to manage JavaScript packages, dependency-check works on those too.

Secure coding practices

Unless your application lives in a vacuum, you will make code changes on a regular basis. Any developer involved with building or reviewing PHP applications should have a basic knowledge of common web application vulnerabilities and secure coding practices.

 Understanding the OWASP Top 10 is a good foundation for general web application security knowledge. Attack vectors such as SQL injection, cross-site scripting (XSS), and cross-site request forgery (CSRF) are common to web applications written in any programming language.

 The next level of security knowledge is to know the specific security considerations and concerns for the PHP language. There are good online guides available to get you started, and the PHP manual itself has an entire section devoted to security.

Static analysis

Static analysis tools read and analyze your application source code, looking for common security vulnerabilities and insecure code structures. For example, the Exakat PHP security scanner can identify unsafe use of the unserialize() function that we examined earlier. Drawbacks of static analysis tools include incomplete rulesets and false positives. There are many open source and commercial PHP static analysis tools available, so do your homework and find ones that work well for you. While they often provide quick and useful feedback on the security of your code, static analysis should never be used as your only security control.

Dynamic analysis

While static analysis tools examine your application’s source code, dynamic analysis tools, such as Arachni or the OWASP Zed Attack Proxy, observe the behavior of running applications. These tools crawl your site, click on links, fill out forms, and do all kinds of unexpected things to your site in order to discover classes of vulnerabilities that can’t be detected using static analysis. If at all possible, you should run these tools against a test instance of your application and not a production site, because they can potentially modify data or break your site.

Make security part of your CI/CD pipeline

Good PHP application security takes time, requires expertise, and demands a broad toolset. If you don’t automate the basics and make security visible, your team will inevitably drift back into poor security habits. One of the best ways to establish a sustainable application security baseline is to integrate security controls into your continuous integration pipeline. Many of the security tools mentioned previously have scriptable command-line interfaces, and some even have first-class CI support, such as the OWASP dependency-check and ZAP plugins for Jenkins.

 When developers notice security issues in their build status reports, they will naturally start fixing them as part of their daily work. Advanced teams will even fail the build when a security check fails, preventing deployment until they can patch the issue. Instead of taking weeks, months, or even years to detect and remediate most security vulnerabilities, you can have a Zero mean time to remediation (MTTR). You can find and fix security problems before unleashing your code on the internet.

Web application firewalls

What about application security problems that arise in production? Despite your best efforts to build security into your product, there will always be opportunities for attackers to exploit your application in the wild. While advanced security monitoring and incident response are beyond the scope of this article, one simple solution that offers substantial security benefits is to use a web application firewall in front of your site.

 Web application firewalls (WAF) stop malicious requests before they can reach your servers. Not only can a WAF prevent common types of attacks, it can also block traffic from sources known for malicious activity. Most commercial web application firewalls act as a reverse proxy and require little to no application or hosting changes to start using. ModSecurity is an open source WAF module you can install on your Apache, Nginx, or Microsoft IIS web server. With the modern increase in threat activity and rise of massive botnets, leveraging a WAF is quickly becoming a requirement for site owners.

Conclusion

Security vulnerabilities are a fact of life. While a security breach can be damaging to your business, there are plenty of ways you can protect your PHP sites and mitigate your risk that don’t require you to be a security genius. Don’t let the recent discovery of PHP 7 security vulnerabilities discourage you from using the latest and greatest version. With the right training, awareness, tools, and practices, you can safely run PHP 7 applications in production today and in the future.

 

The post PHP 7 Vulnerabilities You Can’t Ignore appeared first on Application Performance Monitoring Blog | AppDynamics.

Read the original blog entry...

More Stories By AppDynamics Blog

In high-production environments where release cycles are measured in hours or minutes — not days or weeks — there's little room for mistakes and no room for confusion. Everyone has to understand what's happening, in real time, and have the means to do whatever is necessary to keep applications up and running optimally.

DevOps is a high-stakes world, but done well, it delivers the agility and performance to significantly impact business competitiveness.

Latest Stories
DX World EXPO, LLC, a Lighthouse Point, Florida-based startup trade show producer and the creator of "DXWorldEXPO® - Digital Transformation Conference & Expo" has announced its executive management team. The team is headed by Levent Selamoglu, who has been named CEO. "Now is the time for a truly global DX event, to bring together the leading minds from the technology world in a conversation about Digital Transformation," he said in making the announcement.
"Space Monkey by Vivent Smart Home is a product that is a distributed cloud-based edge storage network. Vivent Smart Home, our parent company, is a smart home provider that places a lot of hard drives across homes in North America," explained JT Olds, Director of Engineering, and Brandon Crowfeather, Product Manager, at Vivint Smart Home, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
SYS-CON Events announced today that Conference Guru has been named “Media Sponsor” of the 22nd International Cloud Expo, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. A valuable conference experience generates new contacts, sales leads, potential strategic partners and potential investors; helps gather competitive intelligence and even provides inspiration for new products and services. Conference Guru works with conference organizers to pass great deals to gre...
DevOps is under attack because developers don’t want to mess with infrastructure. They will happily own their code into production, but want to use platforms instead of raw automation. That’s changing the landscape that we understand as DevOps with both architecture concepts (CloudNative) and process redefinition (SRE). Rob Hirschfeld’s recent work in Kubernetes operations has led to the conclusion that containers and related platforms have changed the way we should be thinking about DevOps and...
The Internet of Things will challenge the status quo of how IT and development organizations operate. Or will it? Certainly the fog layer of IoT requires special insights about data ontology, security and transactional integrity. But the developmental challenges are the same: People, Process and Platform. In his session at @ThingsExpo, Craig Sproule, CEO of Metavine, demonstrated how to move beyond today's coding paradigm and shared the must-have mindsets for removing complexity from the develop...
In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, led attendees through the exciting evolution of the cloud. He looked at this major disruption from the perspective of technology, business models, and what this means for enterprises of all sizes. John Considine is General Manager of Cloud Infrastructure Services at IBM. In that role he is responsible for leading IBM’s public cloud infrastructure including strategy, development, and offering m...
The next XaaS is CICDaaS. Why? Because CICD saves developers a huge amount of time. CD is an especially great option for projects that require multiple and frequent contributions to be integrated. But… securing CICD best practices is an emerging, essential, yet little understood practice for DevOps teams and their Cloud Service Providers. The only way to get CICD to work in a highly secure environment takes collaboration, patience and persistence. Building CICD in the cloud requires rigorous ar...
Companies are harnessing data in ways we once associated with science fiction. Analysts have access to a plethora of visualization and reporting tools, but considering the vast amount of data businesses collect and limitations of CPUs, end users are forced to design their structures and systems with limitations. Until now. As the cloud toolkit to analyze data has evolved, GPUs have stepped in to massively parallel SQL, visualization and machine learning.
"Evatronix provides design services to companies that need to integrate the IoT technology in their products but they don't necessarily have the expertise, knowledge and design team to do so," explained Adam Morawiec, VP of Business Development at Evatronix, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. In his session at @BigDataExpo, Jack Norris, Senior Vice President, Data and Applications at MapR Technologies, reviewed best practices to ...
Widespread fragmentation is stalling the growth of the IIoT and making it difficult for partners to work together. The number of software platforms, apps, hardware and connectivity standards is creating paralysis among businesses that are afraid of being locked into a solution. EdgeX Foundry is unifying the community around a common IoT edge framework and an ecosystem of interoperable components.
"ZeroStack is a startup in Silicon Valley. We're solving a very interesting problem around bringing public cloud convenience with private cloud control for enterprises and mid-size companies," explained Kamesh Pemmaraju, VP of Product Management at ZeroStack, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
Large industrial manufacturing organizations are adopting the agile principles of cloud software companies. The industrial manufacturing development process has not scaled over time. Now that design CAD teams are geographically distributed, centralizing their work is key. With large multi-gigabyte projects, outdated tools have stifled industrial team agility, time-to-market milestones, and impacted P&L stakeholders.
"Akvelon is a software development company and we also provide consultancy services to folks who are looking to scale or accelerate their engineering roadmaps," explained Jeremiah Mothersell, Marketing Manager at Akvelon, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
Enterprises are adopting Kubernetes to accelerate the development and the delivery of cloud-native applications. However, sharing a Kubernetes cluster between members of the same team can be challenging. And, sharing clusters across multiple teams is even harder. Kubernetes offers several constructs to help implement segmentation and isolation. However, these primitives can be complex to understand and apply. As a result, it’s becoming common for enterprises to end up with several clusters. Thi...