













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














What is vulnerability - Correct answer a quality defect, based on bad security practices, notably a flaw in a system design What is threat - Correct answer anything that is able to be exploited by a known vulnerability, intentionally or accidentally, that could potentially hurt an asset What is exploit - Correct answer a piece of code that utilises a known vulnerability to cause unintended or unanticipated behaviour What is authentication - Correct answer the process or action of proving or showing to be true, genuine or valid What is authorization - Correct answer to gain official permission or privelleges to resources (aka access control within infosec) Types of attackers and definition - Correct answer 1. Hacktivist - loosely organised groups with political motivations
not secure as people can disable JS checking or modify the input data with tools like burp suite)
What is non-persistent (reflected) XSS - Correct answer - The malicious code is executed by a victim's browser, and the payload is not stored anywhere
:referrer The Referrer header of the request :remote-addr The remote IP address of the request :remote-user The user authenticated as part of Basic Auth for the request :req[header] The given header of the request :res[header] The given header of the response :response-time The time between the request coming into morgan and when the response headers are written, in ms :status The status code of the response :total-time The time between the request coming into morgan and when the response has finished being written out to the connection, in ms :url The URL of the request :user-agent The contents of the User-Agent header of the request Predefined log formats - Correct answer combined: Apache standard combined format Common: Apache standard common format Dev:
Why log file rotation - Correct answer - The log file can grow to a very large size for applications hosted on the cloud
Match 1 or more occurrences {x} Match exactly x times {x,y} Match between x to y occurrences (inclusive) [123x] Match a single instance of any character in the bracket [0-9] Shortcut for [0123456789], often used with [a-za-Z] [^0-9] Match a single character except those specified in the brackets . Any character \d A digit (0-9) \D A non digit [^0-9] \s A whitespace character (space, tab, line break) \S A non whitespace character [^\s] \w A word character [a-za-Z_0-9] \W A non word character [^\w] XY
Validator.isurl(); What is Sanitization - Correct answer - Process of removing or replacing submitted data
SELECT userid,email,username FROM user WHERE userid=? And role=?; conn.query(sql, [userid,role], function(err, result){...Assuming a user tries to do sqli and supplies a payload like 1' or 1=1;-- - for the userid With the placeholders, the query function will escape the input from the user such that the SQL query will search for userid with the value as "1' or 1=1;-- -" which does not exist - Correct answer With placeholders, escaping which is a form of sanitization is done on the input before the query is executed on the database server Placeholders may also be provided as a key value pair in an array where the key is the column name and value is the value (duh) of the column - Correct answer example: Var sql = SELECT userid,email,username FROM user WHERE? And ?; Conn.query(sql, [userid:${userid},role:${role}], function(err, result){... What is stored prodecures - Correct answer - can restrict access to sensitive columns data if you utilize stored procedures
finduser -- name of stored procedure (IN useridin int, IN rolein varchar(50)) -- Parameters BEGIN SELECT userid, email, username FROM user WHERE userid = useridin and role = rolein; END Calling Stored Procedures in NODE JS - Correct answer var sql=call finduser(?,?); conn.query(sql, [userid,role], function(err, result){... Best practices for preventing sqli - Correct answer - Use placeholders in mysql node library to escape inputsApplying middleware authorisation - Correct answer app.get('/users', verifytoken, (req, res) => { If (!Req.decodedtoken.role !== 'admin') Return res.status(403) .send({ message: 'you dont have sufficient permissions' }); // handle processing Res.status(200).send({ users }); }); Viewing Restricted Content - Correct answer let token = localstorage.getitem('jwt_token'); Var xhr = new xmlhttprequest(); Xhr.open('GET', '/api/users', true); Xhr.setrequestheader('Authorization', Bearer ${jwt_token}); Xhr.onload = function () { If (this.readystate === xmlhttprequest.DONE) { Let response = JSON.parse(this.response); // handle response } }; Xhr.send(); Logout - Correct answer localstorage.removeitem('jwt_token'); What are Cookies - Correct answer help a web application trace visits and activity. When a user has been authenticated, a new session cookie is issued to the client, and the server will maintain some information about each client in its memory JSON web tokens vs session cookies - Correct answer jwt
Session cookies
Session users cookies to store session id which uniquely identifies the user A session... - Correct answer - usually corresponding to one client
{"Message": "Not Authorized"} }Possible attack scenarios for csrf - Correct answer - Modifying product's information in backend