WGU D385| PRE-ASSESSMENT | QUESTIONS WITH VERIFIED
ANSWERS
Correct 30
Incorrect 00
1 of 30
Term
An attacker exploits a cross-site scripting vulnerability. What is the
attacker able to do?
Give this one a try later!
Access the user's data Execute a shell command or script
Gain access to sensitive files on the
Discover other users' credentials
server
Don't know?
2 of 30
,Term
When creating a new user, an administrator must submit the following
fields to an API endpoint:
Name
Email
Address
Password
IsAdmin
What is the best way to ensure the API is protected against privilege
escalation?
Give this one a try later!
Remove IsAdmin from the
Encrypt the incoming request
endpoint
Implement resource and field-level Ensure incoming requests are rate-
access control limited
Don't know?
3 of 30
Term
DOS attacks on network traffic are on the rise. In this lab, use AES
encryption to ensure your TCP is not vulnerable. Using the provided
,template code, fix the encrypt function which should pass the
plain_text to be encrypted. Use line 15 in the templated code to
encrypt the variable input cipher.
Give this one a try later!
if __name__ == '__main__':
zipCode = input()
if zipCode.isdigit():
print(f'Your zip code is {zipCode}.')
else:
print('Please use numeric digits for the zip code.')
OR
try:
# Attempt to convert the input to an integer
int(zipCode)
print(f'Your zip code is {zipCode}.')
except ValueError:
print('Please use numeric digits for the zip code.')
def multiply_numbers(x, y):
if x is None: print("x is a null value")
else: print(f"{x} is not None")
if y is None: print("y is a null value")
else: print(f"{y} is not None")
# Check for None values before attempting multiplication
if x is not None and y is not None: return x * y
else: return None
, def encrypt(self, plain_text):
plain_text = self.__pad(plain_text)
counter = self.block_size.to_bytes(self.block_size, "big")
cipher = AES.new(self.key, AES.MODE_CTR, counter=lambda: counter)
encrypted_text = cipher.encrypt(plain_text.encode())
# This line fixes the issue
return b64encode(counter + encrypted_text).decode("utf-8")
def CelciusToFahrenheit(Temperature):
# Insert assert statement for "Colder than zero degrees Celsius!"
assert Temperature >= 0, "Colder than zero degrees Celsius!"
return ((Temperature*9)/5)+32
Don't know?
4 of 30
Term
An attacker was able to get access to sensitive information. Fix the
templated code provided below to make it more secure. Sample Input:
"Jane Doe " If the code is not fixed properly, the
output to the console will be: "The secret is 'you've just exposed your
secret_key'" Alternatively, when the code is fixed properly the output to
the console should be: "Hello, my name is Jane Doe." Hint: Python
objects can access internal attributes, including a dictionary of global
variables. You can eliminate such vulnerabilities by avoiding invalidated
user inputs. Create a string template object to create simplified syntax
for output specification and then map that object with the keyword
ANSWERS
Correct 30
Incorrect 00
1 of 30
Term
An attacker exploits a cross-site scripting vulnerability. What is the
attacker able to do?
Give this one a try later!
Access the user's data Execute a shell command or script
Gain access to sensitive files on the
Discover other users' credentials
server
Don't know?
2 of 30
,Term
When creating a new user, an administrator must submit the following
fields to an API endpoint:
Name
Address
Password
IsAdmin
What is the best way to ensure the API is protected against privilege
escalation?
Give this one a try later!
Remove IsAdmin from the
Encrypt the incoming request
endpoint
Implement resource and field-level Ensure incoming requests are rate-
access control limited
Don't know?
3 of 30
Term
DOS attacks on network traffic are on the rise. In this lab, use AES
encryption to ensure your TCP is not vulnerable. Using the provided
,template code, fix the encrypt function which should pass the
plain_text to be encrypted. Use line 15 in the templated code to
encrypt the variable input cipher.
Give this one a try later!
if __name__ == '__main__':
zipCode = input()
if zipCode.isdigit():
print(f'Your zip code is {zipCode}.')
else:
print('Please use numeric digits for the zip code.')
OR
try:
# Attempt to convert the input to an integer
int(zipCode)
print(f'Your zip code is {zipCode}.')
except ValueError:
print('Please use numeric digits for the zip code.')
def multiply_numbers(x, y):
if x is None: print("x is a null value")
else: print(f"{x} is not None")
if y is None: print("y is a null value")
else: print(f"{y} is not None")
# Check for None values before attempting multiplication
if x is not None and y is not None: return x * y
else: return None
, def encrypt(self, plain_text):
plain_text = self.__pad(plain_text)
counter = self.block_size.to_bytes(self.block_size, "big")
cipher = AES.new(self.key, AES.MODE_CTR, counter=lambda: counter)
encrypted_text = cipher.encrypt(plain_text.encode())
# This line fixes the issue
return b64encode(counter + encrypted_text).decode("utf-8")
def CelciusToFahrenheit(Temperature):
# Insert assert statement for "Colder than zero degrees Celsius!"
assert Temperature >= 0, "Colder than zero degrees Celsius!"
return ((Temperature*9)/5)+32
Don't know?
4 of 30
Term
An attacker was able to get access to sensitive information. Fix the
templated code provided below to make it more secure. Sample Input:
"Jane Doe " If the code is not fixed properly, the
output to the console will be: "The secret is 'you've just exposed your
secret_key'" Alternatively, when the code is fixed properly the output to
the console should be: "Hello, my name is Jane Doe." Hint: Python
objects can access internal attributes, including a dictionary of global
variables. You can eliminate such vulnerabilities by avoiding invalidated
user inputs. Create a string template object to create simplified syntax
for output specification and then map that object with the keyword