Snyk-Javascript Report 2019
Snyk-Javascript Report 2019
frameworks security
report 2019
powered by
Table of contents 2 Angular and React module ecosystems:
security risks 19
The security risk of indirect dependencies 20
3
Key takeaways 5
Angular and React projects:
overall security posture 29
HTTP security 31
10
4 Security vulnerabilities found in other
frontend ecosystem projects 32
key to surface security issues 12 Vue.js security 33
In this report, we investigate the state of security for both the Angular and React ecosystems. This report by no means
intends to venture into any rivalries that may exist between the two in terms of whether one or the other is a true
framework - we are not comparing them as competitive frameworks at all. Instead, we review them each as viable
frontend ecosystem alternatives for building your JavaScript projects, while focusing on security risks and best practices
for each and the differences between them.
àà the security practices for each of the two different core projects, both Angular and React
àà the state of security of each of the two different module ecosystems, based on an in-depth look at the
vulnerabilities contained in each of the ecosystems
àà the security practices for other common JavaScript frontend framework alternatives such as Vue.js, Bootstrap
and jQuery
àà the significant security differences between the different alternatives, and particularly between Angular and React
This report reviews the overall security of each framework, their community-powered module ecosystems and the
associated security risks with each; based on these insights, this report ultimately provides actionable security advice for
Angular and React users by highlighting best security practices employed in the field in order to ensure secure code.
In order to investigate the overall security posture of each of the ecosystems included in this report, amongst the
factors we discuss are security vulnerabilities identified in the different relevant packages. We review and discuss these
vulnerabilities on the landscape of, and sometimes in comparison to, known vulnerabilities. Known vulnerabilities have
been assigned an identification number in the list of Common Vulnerabilities and Exposures (CVEs) maintained by the
CVE Numbering Authorities (CNAs). CVEs are assigned CVSS scores that provide insight into how severe the listed
vulnerabilities are. Learn more about how the severities of vulnerabilities are scored via their CVSS here.
Angular vs. React core project security Angular vs. React module
ecosystem security
àà Angular contains twenty three security vulnerabilities in its
legacy AngularJS project (Angular v1.x). àà Both React and Angular module ecosystems exhibit security
àà No security vulnerabilities were identified in the core Angular vulnerabilities in highly popular frontend library components
couple of years. Angular and the React ecosystems with an attempt to harvest
credit cards, passwords and other sensitive information used in
àà Only one React core project vulnerability has an official CVE
frontend web applications.
assigned. None of the reported Angular vulnerabilities are listed
by CVE at all. Together, these prove the need for a vulnerability àà The Next.js framework exhibited a great commitment to
database that taps into open source community activities, in security by swiftly addressing all five vulnerabilities found
order to surface relevant security issues. throughout the lifetime of their project, offering fixes within
just one week.
àà Snyk reports twenty six security vulnerabilities across
Angular and React core projects, which npm audit falls short of
in its reports.
àà Angular has visible and attainable security guidelines, a àà jQuery was downloaded more than 120 million times in
security contact and a responsible disclosure policy, all of the last 12 months and according to W3Techs, jQuery v1.x
which are missing from the React project. is used in 84% of all websites using jQuery, which have four
medium severity XSS vulnerabilities affecting it. In fact, if you’re
àà Angular has broader built-in support for data sanitization and
not using jQuery v3.4.0 and above, which is true for the majority
output encoding in different contexts such as URL attributes
of jQuery users, then you are using a version that includes
in HTML anchor (or, link) elements.
security vulnerabilities.
àà React doesn’t have built-in controls for data sanitization, but
àà Bootstrap has been downloaded 79,185,409 times in the past
rather encodes output by default in most cases and leaves it
twelve months, all while containing seven Cross-Site Scripting
up to developers to address unhandled cases such as refs and
(XSS) vulnerabilities. Three of these were disclosed in 2019.
URL attributes (the latter of which is addressed in the React
Notable community modules such as bootstrap-markdown
v16.9.0 release).
have more than 300,000 downloads in the same time frame,
àà Angular includes support for Cross-Site Request Forgery
despite having no security fix or upgrade path to its XSS
(CSRF) vulnerabilities with a built-in security mechanism
vulnerabilities. bootstrap-select features more than two million
in its HTTP service. React developers need to address these
downloads and has a high severity XSS vulnerability that the
issues independently.
Snyk research team surfaced with the help of their proprietary
threat intelligence system.
Let’s begin this report by exploring the different security vulnerabilities found in the
core Angular and React projects. We then review the severity breakdown for each of the
vulnerabilities and we inspect the differences between the two. Lastly, for both projects, we
review the time gap from when a vulnerability was disclosed until it was fixed, as well as
the time gap until the time at which an upgrade was finally published (time-to-fix, time-to-
release) for each of the cases.
Core React project: overview
For the purposes of this report, we considered the The XSS vulnerability in the react-dom v16.x release
react, react-dom, and prop-types libraries to be branch, on the other hand, is quite recent and was
the “core” React modules since, together, they often disclosed just over a year ago, in August 2018. This
make up the foundation for web applications built vulnerability, however, only occurs when other
in React. pre-conditions exist as well, such as using the react-
dom library within a server-side rendering context.
For these core modules, we found three Nevertheless, it is always advisable to stay up-to-
vulnerabilities in total; two in react and one date with security fixes and to upgrade your open
in react-dom. source components as early as possible, in order to
avoid any unnecessary security risks.
All three are Cross-Site Scripting (XSS)
vulnerabilities. The two XSS vulnerabilities in the
React npm package are quite old and include the
0.5.x versions dated back to 2013, and the versions
prior to 0.14 that were disclosed in 2015.
In addition to these three core Reach project vulnerabilities, we also tracked a medium
Deserialization of Untrusted Data security vulnerability in Preact. As many developers prefer
Preact over React, for being lightweight and faster, we thought it was worth having a closer
look. This medium-severity Preact vulnerability affects the 10.0.0 pre-release branch versions
from March and April 2019.
Core Angular project: overview
When we looked at core Angular projects, we Angular downloads per version over time
specifically investigated security vulnerabilities
in the v1.x branch, also referred to as AngularJS.
Angular v1.x Angular (newer versions)
AngularJS is the most widely-used outdated (no
longer maintained) version of Angular. 6 mil.
The above graph demonstrates just how popular the Angular 1.x versions are relative to the other Angular
options: the Angular 2.0 and above versions are represented together by the yellow line; we can see from
the graph that Angular v1.x alone represents about a third (28% to be exact) of all Angular (new and old)
downloads ever.
4
It is this assumption that emphasizes, even more, 4
the critical need to track security vulnerabilities 3 3
in open source components such as the Angular
framework including for older versions, in order
2
Though Snyk has tracked twenty three Angular v1.x security vulnerabilities, none All of this is in contrast to Snyk’s vulnerability database for Angular 1.x which,
of them includes a CVE reference because they were not disclosed through any of for example, reports eleven security reports eleven security vulnerabilities for
the officially-recognized CVE programs. This isn’t necessarily a failing on the part Angular v1.2.32.
of Angular, but rather common practice, as CVEs were designed with commercial
vendors in mind, requiring substantial time and expertise to file - and this doesn’t
Version Published Licenses Direct vulnerabilities
always scale well for open source.
angular 1.6.0-rc.1
21 Nov, 2016 MIT 3 medium
(pre-release)
Without a CVE, vulnerabilities can only be tracked by dedicated analysts who
manage and track open-source activity with customized methods; few solutions angular 1.6.0-rc.0
27 Oct, 2016 MIT 3 medium
provide this option. (pre-release)
React vulnerabilities, and so relying on npm audit can provide developers with a
false sense of confidence.
We can gain further insights into the overall risk To easily compare vulnerabilities, the CVSS translates
posed by the security issues that were found for its numerical scores into ranges, associating each
React-based and Angular-based frontend projects range to its severity type.
by exploring their severity scores.
An in-depth explanation of CVSS and its challenges
is available at https://snyk.io/blog/scoring-security-
What is CVSS? vulnerabilities-101-introducing-cvss-for-cve/.
Looking into Angular v1.x security vulnerabilities, Angular v1.x vulnerability count per year by severity
we can see that Angular v1.5 exhibits the most
vulnerabilities, with seven vulnerabilities in
4
total-three high and four medium. Luckily, the
vulnerabilities further decrease as the version
matures, in terms of both severity and count. In 3
Low
2019, we haven’t yet seen any newly disclosed
vulnerabilities for any Angular versions at all! 2 Medium
High
1
0
2013 2014 2015 2016 2017 2018
Arbitrary Command
1
Execution
Clickjacking 1
0 2 4 6 8 10
An important factor to weigh for the security Average time to fix and release by year
posture of open source projects is how quickly
maintainers and collaborators are able to respond
Avg time to release Avg time to fix
to security vulnerabilities with timely fixes and
to publish releases for their users. We looked
60 days
at both the Angular and the React core projects
for these metrics, tracking the history of known
vulnerabilities that have already been handled in
each in order to chart this data.
40 days
In this section, we review the security risk of the indirect independencies for both Angular and
React, and then we also review the direct dependencies, first for Angular and then for React.
The modules reviewed in this part do not represent a complete list of vulnerable React and
Angular modules; some modules may have special naming conventions (such as all modules
prefixed ng-, angular-, or react- for example) that would not appear in the pattern-based
search we conducted.
The security risk of indirect dependencies
More often than not, projects based on React Following are the security vulnerabilities that are introduced in your code right from the get-go when starting a
or Angular are generated with a scaffolding tool project by using the Angular or React boilerplate:
that provides a boilerplate with which to begin
Indirect
Vulnerable Yearly module
developing. With React, the developer go-to Boilerplate Indirect vulnerability vulnerability Fixable?
module downloads
severity
practice is to use the create-react-app npm
package that creates a pre-configured project Angular jasmine-core ReDoS low 94,559,055
starting point, such as by implementing the Jest
Angular useragent ReDoS high 70,181,373
testing framework, CSS processors and other
already built-in tooling. In Angular, this is made
React lodash Prototype Pollution high 1,005,518,049
possible thanks to the @angular/cli npm package.
A path describes how an open source dependency Due to the prominent usage of lodash throughout Remediating the vulnerability requires pulling new
is introduced to your project. For instance, let’s say the ecosystem, its vulnerable version is ultimately versions of lodash from every single one of the
you have two direct dependencies called Project used by thousands of dependency paths. affected packages in the entire dependency chain.
A and Project B. Both of these projects introduce
dependency, Project C. Project C is now associated
with two different paths, because it is installed by
both Project A and Project B. If Project C includes
vulnerabilities, a developer must consider both of
these paths in order to remediate the vulnerabilities.
Cross-Site Scripting
ag-grid 3 medium 2,203,913
When we look at the Angular module (XSS)
Access Restriction
angular-jwt 1 medium 514,470
Bypass
Cross-Site Scripting
textangular 2 medium 384,629
(XSS)
Cross-Site Scripting
angular-froala 1 medium 104,436
(XSS)
Cross-Site Scripting
angular-redactor 1 medium 64,094
(XSS)
Cross-site Scripting
Denial of Service
92%
As with Angular, we found that the React ecosystem React ecosystem modules -
includes several malicious modules published at some distribution of vulnerability types
point. The following represents the distribution of
security vulnerability types and their counts across
all vulnerable modules that we found, highlighting
Cross-Site Scripting
specifically four malicious packages react-datepicker-
plus, react-dates-sc, awesome_react_utility, react- CSV Injection
server-native.
Insecure Randomness
All four malicious modules have the same malicious
Arbitrary Code
code that harvests credit card and other sensitive
Execution
information; this attack compromised modules on the
Zip Slip - Arbitrary File
React ecosystem as well. Write via Archive
Resources Downloaded
This goes further to emphasize that as a maintainer over Insecure Protocol
of an open source project it is critical to enable multi-
Malicious Package
factor authentication such as 2FA support that the npm
package registry supports, to avoid putting your users
0 1 2 3 4 5
at risk of someone else compromising your account and
Number of vulnerabilities found
publishing malicious versions of your package.
In this section, we explore both the Angular and the React project security postures.
This includes secure coding conventions, built-in in secure capabilities, responsible
disclosure policies, and dedicated security documentation for the project.
The following table lays out a few of the security components we found to be essential
for best-practice maintenance of any open source package, and an indication of how
Angular and React manage said components (if at all).
Security policy components
Examples of https://angular.io/generated/live-examples/security/stackblitz.
No references to any examples of vulnerable projects
vulnerable projects html
DomSanitizer provides a built-in sanitization Potentially malicious input sanitization is at the users' discretion to be
Built-in sanitization function for untrusted values. implemented via 3rd-party libraries, such as DOMPurify.
Reference: https://angular.io/api/platform-browser/DomSanitizer#sanitize Reference: https://github.com/cure53/DOMPurify
Starting with version 1.2, Angular v1.x release branches have introduced compatibility support for Content
Security Policy (CSP) which is necessary due to the use of eval() and Function() methodology to
interpolate expressions.
Cross-Site Request Forgery (CSRF) enables web applications to trust the origin of a request. In newer
Angular versions, CSRF support mechanism is built-in to the HTTP client with the @angular/common/
http module. In Angular v1.x versions similar capability is supported through the $http provider.
Unlike Angular, React doesn’t include an HTTP client and as such, it is unable to provide CSRF support
out-of-the-box. As React aims to be a minimalistic view library, handling this concern is up to the developer,
using custom code or community-powered modules.
After reviewing Angular and React as major JavaScript frameworks, we’ll take a brief
review of selected JavaScript and CSS frameworks: Vue.js, jQuery and Bootstrap.
Vue.js security
The Vue.js frontend framework attracts no As for Vue’s module ecosystem, we found the
less popularity from web developers than following are worth noting:
its counterparts React or Angular, and was
àà bootstrap-vue has 4,620,136 downloads
downloaded 40,054,897 times in the past 12
recorded for the past 12 months and includes a
months and featured as the second most starred
high severity Cross-Site Scripting vulnerability
project on GitHub with more than 145,000 stars.
that was disclosed in January 2019 and affects
all versions prior to <2.0.0-rc.12.
We tracked four vulnerabilities in total for Vue.js
àà vue-backbone had a malicious version
core project, three medium and one low regular
published, associated with malicious package
expressions denial of service vulnerability,
attempts that we mentioned earlier across
spanning from December 2017 to August 2018
Angular and React ecosystem modules. vue-
with a shared Cross-Site Scripting vulnerability
backbone was downloaded 11,658 in the past
that was found in React’s server-side rendering
12 months.
with react-dom component.
Bootstrap is a component library that leverages All vulnerabilities have security fixes and provide an
CSS and JavaScript to enable developers to build upgrade path for users to remediate the risks.
websites and has a strong historical affiliation
with jQuery through plugins that enhance the We were also able to track several modules in the
frameowkr’s core capabilities. Bootstrap ecosystem that are vulnerable. Most
notable are:
Bootstrap is the third-most starred project
àà bootstrap-markdown with more than
in GitHub with more than 130,000 stars, and
300,000 downloads in the past 12 months
79,185,409 downloads in the past 12 months
despite having an unfixed Cross-Site Scripting
from the npm package registry. Modern web
vulnerability affecting all versions
application frameworks like React have even
àà Vue.js developers using bootstrap-vuejs had
extended Bootstrap by packaging it for React
their usage of this module contributed to
based web development with projects like
4,620,136 downloads in the past 12 months
reactstrap and react-bootstrap which receive
and worth to note that a recently disclosed
about 20 million downloads each in the past
high severity Cross-Site Scripting vulnerability
12 months.
affects all versions prior to bootstrap-vue
2.0.0-rc.12 which only a February 2019 release
As we look at known security issues for the
had addressed.
Bootstrap project, we can track a total of seven
Cross-Site Scripting vulnerabilities, three àà bootstrap-select featured 2,159,450 downloads
of which were disclosed in 2019 for recent in the past 12 months and has a high severity
Bootstrap v3 versions, as well as three security Cross-Site Scripting vulnerability that the Snyk
vulnerabilities disclosed in 2018, one of which research team surfaced thanks to its threat
affects the newer 4.x Bootstrap release. intelligence system.
jQuery took web development by storm a decade only recently, on 10th of Apr, 2019, then you are using version 2 and 3 lag far behind with roughly 8% of all
ago but since then web development have been vulnerable jQuery versions. jQuery usage. When looking at the known security
revolutionized further with single page application vulnerabilities and map them out to jQuery versions
technologies such as Angular, and React. That said, Since jQuery is usually found in web applications as a we found that four medium severity Cross-Site
according to W3Techs which regularly run surveys legacy component it is important to also understand its Scripting vulnerabilities are affecting jQuery v1
and report on web technology usage jQuery is version usage patterns and their state of security. which is potentially concerning considering the
being used within 73% of websites they scanned in 83.4% market share for anybody not employing
August 2019. W3Techs reports that of all websites using jQuery, software composition analysis to find and fix
it’s 1.x release is dominating with 83.4% of share and vulnerabilities in their open source components.
A Snyk study from 2017 further amplifies this
when it reported that 77% of sites use at least
one vulnerable JavaScript library and pointed out jQuery vulnerability count by version
jQuery was detected in 79% of the top 5,000 URLs
from Alexa. If you’re still not convinced, npm’s 29%
downloads for the jQuery npm module account to
120,641,977 for the last 12 months alone.
jQuery 1.x
capabilities of jQuery and will turn to community- jquery-airload Malicious Package 2019-08-06 high 322 n/a
powered libraries to do so. jquery.json-
Cross-Site Scripting 2019-07-03 medium 17,898
viewer
github-jquery-
We found 13 vulnerable jQuery libraries as Malicious Package 2019-06-07 high 232 n/a
widgets
provided in the following table and offer the
jquery-mobile Cross-Site Scripting 2019-05-04 medium 54,991
following observations:
jquery-file- Arbitrary Code
2018-11-02 low 19,442
àà Three jQuery libraries are malicious versions upload Execution
of open source community modules. As we jquery.terminal Cross-Site Scripting 2018-08-19 medium 79,982
can’t account for the downloads of the actual jquery.csssr. Regular Expression Denial
2018-02-13 high 3,069
vulnerable versions since this isn’t available validation of Service (ReDoS)
from the npm registry, we should call out jquery-colorbox Cross-Site Scripting 2017-11-14 medium 268,513
jquery.js which is a malicious package and jquery.js Malicious Package 2017-08-02 high 5,444 n/a
accounted for 5,444 downloads in the past
jquery-ui Cross-Site Scripting 2016-07-21 high 8,934,683
12 months.
Cross-Site Request
àà jQuery libraries jquery-mobile, jquery-file- jquery-ujs 2015-06-24 medium 5,763,710
Forgery (CSRF)
upload and jquery-colorbox account to jquery-migrate Cross-Site Scripting 2013-04-18 medium 1,831,735
more than 340,000 downloads in the past
Cross-Site Request
jquery-ui 2012-11-26 medium 8,934,683
12 months, despite including Arbitrary Code Forgery (CSRF)
Execution and Cross-Site Scripting security jquery-mobile Cross-Site Scripting 2012-08-01 medium 54,991
vulnerabilities and not having any upgrade
jquery-ui Cross-Site Scripting 2010-09-02 medium 8,934,683
path to remediate them.
Malicious packages have no fix information.