• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 13 pages
Exam (elaborations)

D385 Software Security And Testing - Questions With Verified Solutions

Document preview thumbnail
Preview 2 out of 13 pages

D385 Software Security And Testing - Questions With Verified Solutions

Content preview

D385 Software Security And Testing - Questions With
Verified Solutions

What is the primary defense against log injection attacks?

A. Do not use parameterized stored procedures in the database
B. Allow all users to write to these logs
C. Sanitize outbound log messages
D. Use API calls to log actions Correct Answer - C. Sanitize outbound log
messages.

The primary defense against log injection attacks is to sanitize outbound log
messages. Log injection is a type of security vulnerability where an attacker
manipulates log messages to inject malicious code or exploit system
vulnerabilities. By sanitizing outbound log messages, you ensure that any
user-supplied input or potentially dangerous characters are properly escaped
or removed before being included in the log.
Sanitizing log messages involves applying input validation and output
encoding techniques to prevent the injection of malicious content. It typically
involves validating the input data, such as user inputs, and sanitizing or
encoding it appropriately to ensure it does not contain any harmful characters
or constructs.
Some common techniques for sanitizing log messages include:
Input validation: Validate and restrict user input to ensure it conforms to
expected formats and does not contain any unauthorized or dangerous
characters.
Output encoding: Encode the log messages in a way that prevents the
interpretation of special characters or malicious constructs. For example, you
can use HTML entity encoding, URL encoding, or database-specific encoding
techniques, depending on the log storage and processing mechanisms.
By properly sanitizing outbound log messages, you can minimize the risk of
log injection attacks and ensure that the logs remain a reliable and secure
source of information for monitoring and analysis purposes.

import logging
import sys
#log division by zero error to the log, the output is printed to the screen
def divideByZeroError(dividend, divisor):

, logging.basicConfig(stream=sys.stdout,format='%(levelname)s:%
(message)s')
try:
quotient = dividend/divisor
print (quotient)
except Exception as e:
#logging error here, use str(e) as part of the output
if __name__ == '__main__':
dividend = int(input())
divisor = int(input())
divideByZeroError(dividend,divisor) Correct Answer - logging.error(' The
exception that occurred is: ' + str(e))

An attacker exploits a cross-site scripting vulnerability. What is the attacker
able to do?

A. Access the user's data
B. Execute a shell command or script
C. Discover other users' credentials
D. Gain access to sensitive files on the server Correct Answer - The
question is about a specific security vulnerability called "cross-site scripting"
(XSS). Cross-site scripting is a type of security flaw in web applications where
an attacker can inject malicious scripts into web pages that are viewed by
other users. These scripts are then executed by the users' web browsers,
allowing the attacker to perform various actions on behalf of the victim.
Let's break down the answer options:
A. Access the user's data This option is correct. With a successful cross-site
scripting attack, the attacker can gain unauthorized access to the user's data,
including personal information, login credentials, cookies, and any other
sensitive information that the user has on the affected website. (CORRECT)
B. Execute a shell command or script This option is not directly related to
cross-site scripting. Executing shell commands or scripts typically involves
other types of security vulnerabilities like command injection or remote code
execution.
C. Discover other users' credentials While cross-site scripting can potentially
allow an attacker to access other users' credentials if they are stored on the
same vulnerable website, it's not the primary purpose of XSS attacks. The
primary goal is to target individual users and steal their data.

Document information

Uploaded on
April 16, 2025
Number of pages
13
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$17.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
StudyHall
3.8
(231)
Sold
1349
Followers
825
Items
17224
Last sold
1 day ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions