Question

Discuss any four of the top Web Application Security Risks as they apply to node.js, and...

Discuss any four of the top Web Application Security Risks as they apply to node.js, and describe their countermeasures using code examples and/or packages that exist to protect against them.

Homework Answers

Answer #1

I will try to explain the most 4 important security needs for nodeJS, (as far as I am concerned)

Prevent automated attack :

Any webpage will be affected by the automated attacks, and it cause severe problms like the traffic flooding and can lead to the shutdown of the server.

This can be prevented using a " multi-factor authentication "

Instead of using the normal passwords in the database, it is always recommetned to use the existing solutions like Firebase Auth, OAuth, etc.

Also in node js, use the npm package , Speakeasy , which helps in implementing 2FA for application by generating one-time tokens.

var speakeasy = require("speakeasy");
var secret = speakeasy.generateSecret({length: 20});// generate ascii, hex, base32, otpauth_url
// generate 6 digit code based on base32 secret
var token = speakeasy.totp({
    secret: secret.base32,
    encoding: 'base32'
});

// verify token coming from client, will return True if tokens match
var tokenValidates = speakeasy.totp.verify({
    secret: secret.base32,
    encoding: 'base32',
    token: req.query.token,
    window: 6
});

// Calculate time step difference in seconds

var tokenDelta = speakeasy.totp.verifyDelta({
    secret: secret.base32,
    encoding: 'base32',
    token: req.query.token
});

Discard Sensitive Data After Use :

According to OWASP, sensitive data exposure has been the vulnerability with the common impact.

To avoid sensitive data exposure, making sure passwords are being encrypted with strong hashing functions such as Argon2.

Enforcing HTTP strict transport security (HSTS) on TLS will prevent packet sniffing and man-in-the-middle attacks by allowing access to your app on HTTPS only.

configure HSTS for node applications as follows :

install hsts library before this

const hsts = require('hsts')
const sixtyDaysInSeconds = 5184000
app.use(hsts({
    maxAge: sixtyDaysInSeconds,
    includeSubDomains: false
}))

Patch Old XML Processors :

Older XML processors by default allow the specification of an external entity. A successful XXE injection attack can seriously compromise the application which it's performed on and its underlying server. For example, consider the normal and simple xml code below;


<?xml version="1.0" encoding="ISO-8859-1"?>
<email>[email protected]</email>
</xml>

Instead of this if an attacker uses the below code,

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE foo [<!ELEMENT foo ANY >
<!ENTITY bar SYSTEM "file:///etc/passwd" >]>
    <email>[email protected]</email>
    <foo>&bar;</foo>

</xml>

He can easily get the password file. to solve this problem, use the package named libxmljs

For example cosidet the code below,

(You need to install this npm package)

var libxml = require("libxmljs");
var parserOptions = {
    noblanks: true,
    noent: false,
    nocdata: true

};

try {
    var doc = libxml.parseXmlString(data, parserOptions);

} 
catch (e) {
    return Promise.reject('Xml parsing error');
}

Enforce Access Control on Every Request

A not good functional testing can cause the Broken access to the application , which helps the attacker to easily get into our system.

One way to stay ahead of this vulnerability is by manually testing application modules which require specific user permissions.

for example, if a normal regular user , who is signed in can access the admin page, then the whole system has to be tested again, as a major problem is there

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Using examples in Ghana, briefly discuss any four (4) roles Policy actors have played during this...
Using examples in Ghana, briefly discuss any four (4) roles Policy actors have played during this period of COVID-19. Please help me out.
Which application testing method tests applications from within using software instrumentation? 1 point SAST: Static Application...
Which application testing method tests applications from within using software instrumentation? 1 point SAST: Static Application Security Testing. IAST Interactive Application Security Testing. PAST: Passive Application Security Testing. DAST: Dynamic Security Application Testing. 57. Question 57 Which one of the OWASP Top 10 Application Security Risks would be occur when there are no safeguards against a user being allowed to execute HTML or JavaScript in the user's browser that can hijack sessions. 1 point Insufficient logging and monitoring Security misconfiguration...
Which architectural pattern is most appropriate for the following multi-user, web-based system for providing a film...
Which architectural pattern is most appropriate for the following multi-user, web-based system for providing a film and photograph library?(1 Point) Please read textbook Chapter 6.3 Architectural Patterns MVC Pattern which separates presentation and interaction from the system data Layered architecture which organizes the system into layers, with related functionality associated with each layer Repository architecture - all data in a system is managed in a central repository that is accessible to all system components. Components do not interact directly, only...
QUESTION 1 Advanced Security Inc. was hired by the Treasury Bank Inc. for securing their systems....
QUESTION 1 Advanced Security Inc. was hired by the Treasury Bank Inc. for securing their systems. The first thing they did was implement the best practice if separation of domains. As a result of this The bank had to get a new domain name. any change made in the records points to only one party who could have made that change. If you are a technical person, you must have office in a particular area of the building. accessing outside...
Case Study You have just been hired as the new treasurer of an Australian firm called...
Case Study You have just been hired as the new treasurer of an Australian firm called Sun Solar Panels (SSP). SSP produces commercial solar panels. It is a well established brand in both the UK and New Zealand. In fact, it distributes (sells) its entire output to UK and New Zealand retailers. These sales are made through SSP's UK and New Zealand subsidiaries which act as distributors of the product. Each wholesale transaction in the UK is settled in GBP...
Funding an IS project through a Chargeback method involves: Pricing the IS service out for the...
Funding an IS project through a Chargeback method involves: Pricing the IS service out for the customer buying the end product Direct billing by the firm for IS resources or services to the department that uses them Direct billing by the manager of a function for IS resources or services to an employee that uses them An accounting process that reduces tax liability for capital investments All of the following are attributes of considering IS costs as Overhead except the...
Please show me how to apply CVP analysis for this case study. FLY ASH BRICK PROJECT:...
Please show me how to apply CVP analysis for this case study. FLY ASH BRICK PROJECT: FEASIBILITY STUDY USING CVP ANALYSIS S. K. Mitra and Shubhra Hajela wrote this case solely to provide material for class discussion. The authors do not intend to illustrate either effective or ineffective handling of a managerial situation. The authors may have disguised certain names and other identifying information to protect confidentiality. This publication may not be transmitted, photocopied, digitized or otherwise reproduced in any...
Nokia Actively Uses Social Media to Communicate Apply the knowledge of Management presented in this chapter...
Nokia Actively Uses Social Media to Communicate Apply the knowledge of Management presented in this chapter to the following case. Applying this knowledge should enable you to have a better understanding of how Nokia uses social media to its advantage. Read the case below and answer the questions on the right. Nokia is a Finnish multinational communications and information technology company. It was founded in 1865. In 2015, the company had 114,256 employees and four business groups: Nokia Networks, Nokia...
for the scenario below: 1) Apply the qualitative analysis by identifying at least 3 issues in...
for the scenario below: 1) Apply the qualitative analysis by identifying at least 3 issues in the above process. Analyse these issues by using a. Adding-value and Waste Analysis b. Issue register, If you find that there are more than three issues, you can focus on the three issues that have the highest impact. 2). Calculate the cycle time efficiency of the as-is process. You can assume a working week of 40 hours. In case there is missing information, you...
How this case apply to globalization ? FREEPORT, Pa. The rising dollar is putting US. Manufacturers...
How this case apply to globalization ? FREEPORT, Pa. The rising dollar is putting US. Manufacturers through the equivalent of a new year's fitness regime, causing pain for now but also promising long-term gains in efficiency. After more than a decade of weakness, the dollar began surging in mid-2014 against the euro and many other currencies. That is making U.S.-made products pricier in other countries and imports cheaper in the U.S.-a combination that is likely to expand, the already gaping...