A Free Book
A Free Book
m
pl
im
en
ts
of
Protecting
Your Web
Applications
Solutions and Strategies to
Combat Cybersecurity Threats
REPORT
Relentlessly Protecting
the Experience
cloud.oracle.com/edge
Protecting Your Web
Applications
Solutions and Strategies to Combat
Cybersecurity Threats
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Protecting Your
Web Applications, the cover image, and related trade dress are trademarks of O’Reilly
Media, Inc.
The views expressed in this work are those of the authors, and do not represent the
publisher’s views. While the publisher and the authors have used good faith efforts
to ensure that the information and instructions contained in this work are accurate,
the publisher and the authors disclaim all responsibility for errors or omissions,
including without limitation responsibility for damages resulting from the use of or
reliance on this work. Use of the information and instructions contained in this
work is at your own risk. If any code samples or other technology this work contains
or describes is subject to open source licenses or the intellectual property rights of
others, it is your responsibility to ensure that your use thereof complies with such
licenses and/or rights.
This work is part of a collaboration between O’Reilly and Oracle Dyn. See our state‐
ment of editorial independence.
978-1-492-05276-0
[LSI]
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v
iii
Preface
v
CHAPTER 1
Today’s Threat Landscape
1
such a high-profile topic that in 2001, computer scientist and cyber‐
security expert Mark Curphey founded the Open Web Application
Security Project (OWASP) to provide unbiased information about
application security. OWASP tools and documents are free and open
to anyone interested in improving application security.
Web security remains one of the top concerns of businesses of all
sizes. Add the ongoing threat to web security to the new landscape
of cloud-based, Everything-as-a-Service (XaaS) offerings, and it’s
clear that the threat landscape is as big and diverse as the internet
itself. The wave of public compute, storage, and other cloud assets
moves the integrity of hub-and-spoke datacenters of the 1990s and
2000s with strict governance to a world in which cloud definitions
can be defined differently per provider. From a technical perspec‐
tive, security breaches are expensive to mitigate. The Ponemon
Institute’s 2018 Cost of a Data Breach Study: Global Overview
reveals that the average cost of a data breach is $3.86 million and the
average cost per lost or stolen record is $148. A company that suffers
a data breach, on any scale, should prepare for significant revenue
losses from legal fees, free or discounted services to affected custom‐
ers, and reputation damage.
There are risks associated with exposing any application to the inter‐
net or even to internal users via corporate intranet portals. Security
researchers, hackers, nation states, and various other malicious
attackers continuously search for vulnerabilities and exploits for
those vulnerabilities. According to Verizon’s 2018 Data Breach
Investigations Report, web applications top the list for types of
breaches. Maintaining vigilance, keeping systems and applications
patched, and providing best available perimeter protection still does
not guarantee 100% security for any environment. Although these
measures certainly don’t hurt security, new vulnerabilities can still
arise with every code upgrade, update, and patch.
Security professionals know that cybercriminals can take many
paths to breach data, exploit vulnerabilities, and compromise secu‐
rity. Web-based applications are especially vulnerable because of the
1 Source: 2018 Bad Bot Report: The Year Bad Bots Went Mainstream by Distil Networks
Price Scraping
There’s a threat that’s almost as rampant as credit card-related theft:
price scraping. This occurs when a bot places items into a shopping
cart to reveal prices and discounts given on a dynamic basis.
Dynamic pricing is an important online sales strategy used by ecom‐
merce portals to influence consumer-buying behaviors.
Content and price scraping not only leads to the aforementioned
inventory problem, but it also allows competitors to capture (scrape)
pricing and discount levels, which can give them a significant
advantage. The data scraper analyzes the site’s dynamic pricing intel‐
ligence and can override this strategy to strengthen its own pricing
and gain an unfair advantage over victims. The content part of the
equation is about gathering a company’s product catalog so that the
scraper can offer the same exact product at a lower price.
2 Source: https://solutions.aberdeen.com/oracle_web_security
Click Fraud
Click fraud has multiple definitions. One definition is when some‐
one increases their online popularity by buying “likes” or clicks on a
web posting. The other definition—the one we use for the purposes
of this report—is using a botnet to rack up ad costs with fraudulent
ad clicks. Bots are especially effective at clicking an ad to record an
“impression” and incurring an ad charge. There are multiple ways in
which this type of fraudulent behavior can financially harm its vic‐
tim (although there is generally no financial gain for any of the
malicious parties involved):
Malicious intent
Malicious actors can launch a campaign to increase charges to
an innocent advertiser.
Friends helping friends
Friends attempt to help a publisher by clicking ads to boost rev‐
enue to the publisher. When discovered, the publisher is often
accused of click fraud.
Competitors
These fall into two groups: advertising competitors and publish‐
ing competitors. Advertising competitors want the advertiser to
pay for irrelevant ad clicks. In the case of publishing competi‐
tors, the competitor wants the publisher to be accused of click
fraud.
The use of botnets for this type of activity is obvious—the difficulty
is in tracking down the perpetrator. The only party who suffers is
the one who pays for the advertising to drive traffic to a site. The
advertising party pays regardless of whether the clicks are valid,
which hurts business and profits, and the advertising party could be
accused of click fraud, which would result in reputation damage.
These bots invoke fraud, which could mean thousands of pretend
clicks for which the advertiser must pay.
DDoS attacks can take the form of distraction attacks, meaning that
the DDoS attack is a big fire to put out when the real menace lurks
just below your radar, compromising systems or services.
DDoS attackers disrupt your service until the malicious payload suc‐
cessfully infects your systems, and then they disappear back into the
internet’s traffic stream. You might not realize that another attack
has occurred for months.
Credential Stuffing
In a credential stuffing attack, a malicious actor purchases or
extracts a set of user credentials and then employs a botnet to test
those credentials against websites. This attack succeeds because peo‐
ple tend to reuse usernames and passwords on multiple sites. Open
web forms are the most vulnerable because they don’t offer any
other validation such as a human verification or a two-factor option.
These types of forms are highly vulnerable to credential stuffing.
The financial sector is a prime target for fraudsters. A June 2018
Ponemon Institute report (“The Cost of Credential Stuffing: Asia-
Pacific”) states that there were more than 30 billion malicious login
attempts from November 2017 to June 2018. The attacks mostly ori‐
ginated from the United States, Russia, and Vietnam.
Retail sites are also vulnerable because most do not implement mul‐
tifactor authentication. Multifactor authentication is a basic defense
against these types of attacks. Attackers depend on sites that only
use username and password authentication. A second factor, no
matter how simple, is a good deterrent.
According to respondents to the Ponemon study, credential stuffing
attacks lead to costly application downtime, customer loss, and
expensive IT and security team remediation tasks.
Here’s a quick summary of the Ponemon study:
SQL Injection
SQL injection is an attack resulting from poor user data entry valida‐
tion or other poor coding practices (e.g., a web form that allows a
user to input untrusted data, tricking the application into executing
unintended commands). Injections can be SQL queries, PHP quer‐
ies, lightweight directory access protocol (LDAP) queries, and oper‐
ating system commands.
Malicious users allowed to enter open-ended input into a web form,
without any coding protection or input sanitizing, can launch injec‐
tion attacks that result in data theft, data exposure, data loss, data
corruption, denial of access, and host takeover. Security researchers
find that injection flaws are very prevalent, especially in legacy code.
Attackers find and exploit vulnerable code using scanners and fuz‐
zers, which are software applications specifically designed to find
such coding flaws.
Cross-Site Scripting
A cross-site scripting (XSS) attack is a type of injection that involves
placing malicious scripts into websites. The attacker uses a web
application to send malicious code to a user in the form of a
Conclusion | 13
CHAPTER 2
Threat Protection Strategies
15
The SOC is a necessity at the large-enterprise level, but for small to
mid-sized companies, it’s an expensive luxury. At the same time,
malicious actors know that mid-sized companies are high-value tar‐
gets. There’s enough information in some of these companies to
keep an intruder happy for months. That information can include
high value data like PII, intellectual property, proprietary code,
drawings, diagrams, credit card data, health information, and doz‐
ens of other data types that attackers can sell on the dark web.
Organizations that produce intellectual property are high-value tar‐
gets, as are government contractors, health care facilities, manufac‐
turers, and security companies. Malicious actors love to pilfer data
from security companies, especially high-profile ones, because it
shows off their power.
The huge expense of spinning up an on-premises SOC is out of the
question for many companies because of the considerable resources
required for such an undertaking. The solution is to outsource the
SOC function to a third party like a “SOC-as-a-Service” company.
This type of service provides the skills and watchful eyes that smaller
companies need, without the huge internal outlay for skilled resour‐
ces, hardware, software, and training. Additionally, many SOC-as-a-
Service companies monitor and protect customers’ assets all day,
every day.
Another positive aspect of a managed security service is that the
SOC doesn’t work in a vacuum. A threat at one client’s location is
immediately communicated to all client companies.
The consumption of any third-party as-a-service offering is like any
other—you must do some shopping to find which one fits you and
your company’s needs.
The last question in the list might seem odd, until one considers that
attempts on security companies are common and persistent. You
need to know that your service provider will keep your data safe.
An outsourced, third-party SOC is a good option for companies
without a budget to create one from scratch. However, outsourcing
your SOC comes with a few cautions. First, you have no control over
the SOC, its detection methods, its notification speed, or its reme‐
diation speed or path. Second, you have no input regarding hiring
practices or delegation of resources. In other words, the SOC could
be staffed with relatively untrained technicians. You need to decide
which limitations you can tolerate in exchange for the convenience
and cost savings of an outsourced SOC.
An Integrated Approach
There is no single security panacea for web applications. The threat
landscape is too large and too varied for a single solution. We sug‐
gest using an integrated approach to all security issues, but specifi‐
cally for those related to web applications. A combination of secure
programming, data encryption, WAFs, operating system security,
least-privilege user security, segmented networks, and so-called
“demilitarized zones” for corporate hosted, internet-facing applica‐
tions to name a few.
An integrated approach is good news for the business consumer
because it means vendor lock-in is not an issue. Vendor lock-in
occurs when organizations are bound to a single vendor because it
offers a one-size-fits-all proprietary solution. No single company
does everything well. Addressing security needs with integration in
mind is a better method of serving customers and protecting assets.
Conclusion
Today’s threat landscape is too large, too complex, and changes too
quickly to approach it with a single strategy or solution in mind. It
requires automation, best practices-based implementation, strong
software solutions, and the right people to manage those resources.
An integrated approach is the best remedy for maintaining vigilance
and implementing a multilayer security strategy in a business envi‐
ronment under constant attack.
21
In this chapter, we explore the technologies that you should include
in your protection strategy—bot management, artificial intelligence
(AI), and machine learning—and we offer concrete prevention and
mitigation methods for common web-based attacks.
• Consider using a data subset rather than the entire database for
external users.
• Encrypt database connection strings.
• Change default security settings.
• Use LIMIT where possible to reduce the number of possible
exposed records.
• Avoid wildcard statements such as SELECT * FROM.
• Change application account passwords often.
• Create custom error codes that don’t expose table structures.
• Use a web application firewall (WAF).
We won’t dig deep into each of these rules, but you can see a pattern
in them: Escape untrusted data. Escaping means to ignore special
characters by preceding them with “escape” characters. Escape char‐
acters vary depending on the programming language. For example,
in some scripting languages such as PHP, programmers use the “\”
to escape characters introduced in the course of normal program‐
ming or by malicious users.
There are some flaws that you can’t fix by using escaping, such as
allowing JavaScript code to run from an untrusted source. The rule
here is to deny all untrusted script elements and then selectively
allow input as needed. As the OWASP team suggests, the first three
Conclusion
Web-based applications are under constant threat from attackers. In
this chapter, we offered strategies to prevent and mitigate the impact
of those attacks to protect data and users from various types of fraud
and theft. AI and machine learning are both promising technologies
that should relieve some of security professionals’ burden because of
the vast amount of data that can be scraped and analyzed in an auto‐
mated fashion.
27
corporate security can be tightened to allow only outgoing access
because there are no corporate-hosted services that require access
through a corporate firewall. This move greatly enhances internal
network security.
Another example is that criminal hackers, hacktivists, and advanced
persistent threat groups might infiltrate or compromise a portion of
a corporate network, but the highly secure business applications will
be protected off-site and separately from other internal corporate
assets. Responsibility for data theft will shift to the third-party pro‐
viders who are responsible for protecting their customer’s data.
The transition from traditional, internally supported web applica‐
tions and internal security to the cloud and to third-party providers
is the direction many businesses have taken. But this does not shift
all of the responsibility, compliance requirements, or damages to a
third party in the case of a breach or a compromise. Although some
downsizing of IT and security departments is a possible side effect of
a cloud initiative, it will not altogether alleviate the need for in-
house trained professionals. Businesses must retain trained security
and IT professionals to monitor, inspect, and occasionally audit
their third-party providers.
We foresee, over the next three to five years, that large companies
will transition toward cloud-based security, managed security serv‐
ices, and support models—transferring the bulk of their compute,
hosting, and security operations to third-party providers. Small to
medium-sized businesses, being more agile and less entrenched in
on-premises solutions, will make the transition much faster and
with fewer barriers. Startup, cloud-native, and so-called “virtual”
companies will launch in the cloud and likely never own or control
their own infrastructures. All security, IT, and web application serv‐
ices will live entirely in the cloud from day one.
Third-Party Outsourcing
We also believe that this transition to the cloud will include a move
to outsourced services, such as SOCs. Again, this move will also
begin as a hybrid scenario in which companies will augment their
in-house SOCs with outsourced ones to attain 24/7/365 monitoring,
protection, reporting, and remediation of incidents. The complete
transition to a fully outsourced solution might take several years to
complete. A 100% reliance on outsourced services requires that
Conclusion
Moving threat protection to third-party entities and to the cloud
should result in better coverage, fewer incidents, and lower costs.
The benefits to online shoppers, brick-and-mortar retail customers,
financial institutions, and health care facilities are better fraud pro‐
tection, reduced incidents of identity theft from online leaks, better
privacy protection, and a smaller target surface for attackers when
the corporate network is removed from the picture.
Web application attacks are on the rise. The attacks are more sophis‐
ticated and use more brute-force attack strategies than seen in previ‐
ous years. Organizations must continually examine and reexamine
strategies for protection, mitigation, and remediation. To stop web
application attacks, organizations need to deploy a multilayer
approach to security that includes WAFs, multifactor authentication,
artificial intelligence, machine learning, secure programming, and
big data analytics.
Conclusion | 29
About the Authors
Gary Sloper is a Vice President at Oracle Dyn. Gary brings over 20
years’ experience to his leadership of the global solutions engineer‐
ing and customer success teams. His organization architects and
implements cloud-based Edge Services, including providing deliver‐
ability and security services to help customers monitor, control, and
optimize their CDN and hybrid cloud workloads.
Kenneth “Ken” Hess is a full-time system administrator and a free‐
lance technology writer and journalist. He writes on a variety of top‐
ics including security, virtualization, Windows, open source
software, databases, storage, and networking. In his spare time, Ken
is an avid and award-winning filmmaker and a dabbler in the visual
arts.