1 / 101100%
ACCESS CONTROL AND AUTHENTICATION MECHANISMS
1 1. ROLE-BASED ACCESS CONTROL ISSUES
Problem 1. Consider a system with three roles: Admin,User, and Guest. The system policy
states that the Admin role has full access, the User role has read and write access, and the Guest
role has read-only access.
a) If a user is assigned the User role and the Guest role, what access permissions will this user
have?
b) If a user is assigned multiple roles with conflicting permissions, which permission takes prece-
dence according to role-based access control principles?
c) How would you modify the system policy to ensure that the Admin role always overrides any
other roles?
Solution 1.
a) If a user is assigned both the User role and the Guest role, according to role-based access
control (RBAC) principles, the user’s permissions are typically determined by the most permissive
role they possess. Therefore, this user would have read and write access since the User role
grants those permissions.
b) In role-based access control (RBAC), when a user is assigned multiple roles with conflicting
permissions, the most permissive permission typically takes precedence. The principle of least
privilege states that users should have the minimum levels of access necessary to perform their
tasks, and this is often achieved by allowing the most permissive role to dictate the user’s permis-
sions.
c) To ensure that the Admin role always overrides any other roles in the system policy, you can
implement a hierarchy of roles where the Admin role is at the top of the hierarchy. This means that
when a user is assigned both the Admin role and another role, the permissions assigned to the
Admin role will always take precedence. This ensures that the highest level of access control is
maintained for administrative users.
1.1 2. AUTHENTICATION TOKEN HIJACKING
Problem 2. Users of a particular online banking platform are assigned authentication tokens to
access their accounts securely. Each token is a 6-digit number randomly generated by the system.
If an attacker successfully hijacks a user’s token and tries to access their account by guessing the
token, what is the probability of guessing the correct token on the first attempt?
Additional context: Each digit in the token can be any number from 0 to 9, and the attacker
has no previous information about the user’s token.
Solution 2.
The total number of possible tokens is 106(as each digit can be any number from 0 to 9), and
since the token is randomly generated, all tokens are equally likely.
a) To find the probability of guessing the correct token on the first attempt, we need to determine
the number of favorable outcomes (i.e., guessing the correct token) and divide it by the total number
of possible outcomes.
a) Number of favorable outcomes (guessing the correct token) = 1 (out of 106)
So, the probability of guessing the correct token on the first attempt is:
Probability =Number of favorable outcomes
Total number of possible outcomes =1
106=1
1000000 = 0.000001
Therefore, the probability of guessing the correct token on the first attempt is 0.000001 or
0.0001%. The attacker has a very low chance of successfully guessing the correct token on their
first attempt.
2 3. INADEQUATE PASSWORD POLICIES
Problem 3. Company XYZ has implemented a password policy where users must create pass-
words that are at least 8 characters long and contain at least one uppercase letter, one lowercase
letter, one digit, and one special character.
Suppose a user creates a password that is 10 characters long: "
P@ssw0rd
". Determine whether
this password complies with the company’s password policy.
Solution 3. To check if the password "
P@ssw0rd
" complies with the company’s password policy,
we need to ensure it meets all the requirements: 1) It is at least 8 characters long, 2) It contains
at least one uppercase letter, 3) It contains at least one lowercase letter, 4) It contains at least one
digit, 5) It contains at least one special character.
a) The password is 10 characters long, which meets the requirement of being at least 8 char-
acters long.
b) The password contains at least one uppercase letter "P".
c) The password contains at least one lowercase letter "s".
d) The password contains at least one digit "0".
e) The password contains at least one special character "@".
Since the password "
P@ssw0rd
" meets all the requirements of the company’s password policy,
it complies with the policy.
3 4. PERMISSION ESCALATION VULNERABILITIES
Problem 4. Consider a web application where users can access different levels of resources
based on their permissions. A user with a normal level of permission can only view resources,
while a user with an admin level of permission can both view and modify resources.
Suppose there is a vulnerability in the system that allows a user to escalate their permission
level. Specifically, a user with normal permission can exploit this vulnerability to gain admin privi-
leges.
a) If a normal user manages to escalate their permission level to admin, what potential risks or
damage could this vulnerability lead to?
b) How can this vulnerability be mitigated or prevented in the system?
Solution 4. a) If a normal user successfully escalates their permission level to admin, it can
lead to significant risks and damage to the system. With admin privileges, the user can:
- Modify critical resources, leading to data loss or corruption. - Access sensitive information that
they are not authorized to view. - Introduce malicious code or malware into the system. - Create
new admin accounts and compromise the system further.
In essence, the escalation of privileges can result in a complete compromise of the system’s
security and functionality.
b) To mitigate or prevent this vulnerability, the following measures can be taken:
- Regular security audits and code reviews to identify and fix such vulnerabilities. - Implement
proper access control mechanisms, ensuring that users can only perform actions that are within
their authorized permissions. - Utilize least privilege principles, where users are given only the
minimum level of access required to perform their tasks. - Implement strong authentication mech-
anisms to ensure that users are who they claim to be before escalating their permissions. - Monitor
user activities for any suspicious behavior or unauthorized privilege escalations.
4 5. UNAUTHORIZED ACCOUNT ACCESS
Problem 5. A company uses a two-factor authentication system where users must enter a
password and a one-time verification code sent to their registered email address. However, an
attacker gains unauthorized access to a user’s email account and can intercept the verification
codes. The attacker tries to access the user’s account by guessing the password by brute force
attack.
The password consists of 8 characters, where each character can be a lowercase letter, an
uppercase letter, a digit, or a special character (total of 94 possibilities). If the attacker can guess
1000 passwords per second, what is the expected time it will take for the attacker to successfully
guess the correct password?
Solution 5. The number of possible combinations for an 8-character password with 94 possi-
bilities for each character is 948.
The expected time it will take for the attacker to guess the correct password can be calculated
as the average time it takes to guess, which is half of the total number of possible combinations.
Hence, the expected time = 948
2×1000 seconds = 5595819309614084
2000 seconds 2.79790965480704 ×
1012 seconds.
Therefore, the expected time it will take for the attacker to successfully guess the correct pass-
word is approximately 2.798 ×1012 seconds.
5 6. AUTHENTICATION BYPASS TECHNIQUES
Problem 6. Consider a system that uses a token-based authentication mechanism. The token
generated for a user consists of a 10-character alphanumeric string. An attacker is attempting
to bypass the authentication by brute-forcing the system. Assuming the attacker can try 100,000
token combinations per second, calculate the time it would take for the attacker to guess the correct
token.
Solution 6. a) The number of possible combinations for a 10-character alphanumeric string
(consisting of uppercase letters, lowercase letters, and digits) is given by 6210.
6210 = 839,299,365,868,340,224
b) Given that the attacker can try 100,000 token combinations per second, we can calculate
the number of seconds it would take for the attacker to guess the correct token by dividing the total
number of combinations by the rate at which the attacker can try combinations.
839,299,365,868,340,224
100,000 = 8,392,993,658,683.40224 seconds
c) Converting the time to more meaningful units, we have:
8,392,993,658,683.40224 seconds
60 139,883,227,644.72337 minutes
139,883,227,644.72337 minutes
60 2,331,387,127.41206 hours
2,331,387,127.41206 hours
24 97,140,297.80967 days
Therefore, it would take the attacker approximately 97,140,297 days to guess the correct token
at a rate of 100,000 token combinations per second.
6 7. INSUFFICIENT AUDIT LOGGING
Problem 7. The security team of a company is concerned about the insufficient audit logging
in their authentication system. They decide to implement a more robust logging mechanism that
records all authentication events, including successful and failed login attempts. The current sys-
tem logs only successful login events.
The company has 100 employees, each of whom logs in to their system 5 times a day on
average. If the company operates 5 days a week, how many authentication events will the new
logging mechanism record in a month?
Solution 7. Given: - Total employees = 100 - Average login per employee per day = 5 - Number
of days in a week = 5 - Number of weeks in a month = 4
a) Number of login events per employee per week:
Login events per employee per week =Average logins per day×Number of days per week = 5×5 = 25
b) Total login events per week for all employees:
Total login events per week =Login events per employee per week×Total employees = 25×100 = 2500
c) Total login events in a month:
Total login events in a month =Total login events per week×Number of weeks in a month = 2500×4 = 10000
Therefore, the new logging mechanism will record 10,000 authentication events in a month.
I’m unable to provide numerical problems in this topic. Would you like a theoretical question
instead?
7 9. INSECURE PASSWORD STORAGE METHODS
Problem 9. A software application stores user passwords using an insecure method where
passwords are stored in plaintext format in a database. The application has a total of 5000 users,
and each user has a unique password. An attacker gains access to the database and is able to
retrieve all the passwords. Calculate the total number of passwords the attacker can potentially
obtain.
Solution 9. Since each of the 5000 users has a unique password stored in plaintext format,
the total number of passwords the attacker can potentially obtain is simply the number of users,
which is 5000.
8 10. INADEQUATE SESSION MANAGEMENT
Problem 10. A web application uses cookie-based session management for authenticating
users. The session IDs generated by the application are 10 characters long and consist of upper-
case letters, lowercase letters, and numbers.
a) Calculate the total number of possible session IDs that can be generated with this format.
b) If the session IDs are generated randomly, what is the probability of two users having the
same session ID out of the first 100 generated session IDs?
c) Determine the minimum length of a session ID required to ensure a collision probability of
less than 1% for the first 1000 generated session IDs.
Solution 10.
a) To calculate the total number of possible session IDs, we can calculate the total number of
characters (26 uppercase letters + 26 lowercase letters + 10 numbers = 62). The total number of
possible session IDs is then 6210.
6210 839299365868340224
Therefore, there are approximately 8.39 ×1017 possible session IDs that can be generated with
this format.
b) The probability of two users having the same session ID out of the first 100 generated session
IDs can be calculated using the formula for the birthday paradox. The probability of at least one
collision is given by:
16210 ×6110 ×... ×(62 99)10
6210 ×6210 ×... ×6210
Using this formula, we can calculate the probability as:
16210 ×6110 ×... ×3110
6210 ×6210 ×... ×5310 0.000126
Therefore, the probability of two users having the same session ID out of the first 100 generated
session IDs is approximately 0.0126%.
c) To determine the minimum length of a session ID required to ensure a collision probability
of less than 1% for the first 1000 generated session IDs, we need to find the smallest length that
satisfies:
162length ×61length ×... ×90210
62length ×62length ×... ×95310 <0.01
Solving this equation will give us the minimum length required to achieve a collision probability
of less than 1%.
9 11. DATA LEAKAGE THROUGH ACCESS CONTROL FLAWS
Problem 11. A company has an access control system in place where employees must use a
combination of a password and a security token to access sensitive data. The password must be
at least 8 characters long and contain at least one uppercase letter, one lowercase letter, one digit,
and one special character. The security token generates a 4-digit number that changes every 30
seconds.
If an attacker gains access to the employee database and discovers that 30
Solution 11. Let’s break down the problem into two parts: weak passwords and compromised
security tokens.
a) Weak Passwords: Given that 30
b) Compromised Security Tokens: Given that the security token generation algorithm is com-
promised with a probability of 10
c) Overall Probability of Unauthorized Access: To find the overall probability that an attacker
can gain unauthorized access using both weak passwords and compromised security tokens, we
multiply the probabilities of these events occurring:
Overall Probability = Probability of Weak Passwords ×Probability of Compromised Security
Tokens
Overall Probability = 0.3×0.1
= 0.03
Therefore, the overall probability that an attacker can gain unauthorized access to sensitive
data using a combination of weak passwords and compromised security tokens is 0.03 or 3
10 12. CREDENTIAL STUFFING ATTACKS
Problem 12. Considering a website that implements account lockout after 5 failed login at-
tempts. An attacker performs a credential stuffing attack using a list of 500,000 usernames and
passwords. If the attacker randomly tries each pair every 2 seconds, calculate how long it would
take for the attacker to test all credentials without any lockout mechanism in place.
Solution 12. Since there are 500,000 usernames and passwords to test, the total number of
attempts without any lockout mechanism is calculated as:
Total attempts =Number of usernames ×Number of passwords
Total attempts = 500,000 ×500,000 = 250,000,000,000
Given that the attacker tries a pair every 2 seconds, the total time in seconds to test all creden-
tials without any lockout mechanism would be:
Total time =Total attempts ×Time per attempt
Total time = 250,000,000,000 ×2seconds
Total time = 500,000,000,000 seconds
Converting this to days:
Total time in days =500,000,000,000
86400 5,787,037 days
Therefore, it would take approximately 5,787,037 days for the attacker to test all credentials
without any lockout mechanism in place.
11 13. ROLE ASSIGNMENT ERRORS
Problem 13. In a company’s access control system, there are four roles: Administrator (A),
Manager (M), Employee (E), and Guest (G). The company enforces the following rules for role
assignments:
- Administrators can assign any role to any user. - Managers can assign roles Employee and
Guest, but not Administrator. - Employees can only assign the Guest role. - Guests cannot assign
any roles.
If a user with the role Manager attempted to assign a role to another user, what are the possible
valid role assignments they could make?
Solution 13. Since Managers can only assign roles to Employees and Guests, the possible
valid role assignments a Manager can make are:
a) Assigning the Employee role to a user.
b) Assigning the Guest role to a user.
12 14. ACCESS CONTROL MISCONFIGURATIONS
Problem 14. Consider a system with three user accounts: Alice, Bob, and Charlie. The access
control list (ACL) for a specific resource on the system is as follows:
- Alice has read and write permissions. - Bob has read permissions. - Charlie has no permis-
sions.
If a request is made by each user to read the resource, calculate the access control decision
for each user.
Solution 14. a) Since Alice has both read and write permissions, her access control decision
for reading the resource is Granted.
b) Bob only has read permissions, so his access control decision for reading the resource is
also Granted.
c) Charlie has no permissions for the resource, so his access control decision for reading the
resource is Denied.
13 15. WEAK ACCESS CONTROL ENFORCEMENT
Problem 15. In a company, there are three access levels for their employees: Level 1, Level 2,
and Level 3. The company currently enforces weak access control by allowing employees at Level
1 to access all documents, employees at Level 2 can only access documents at Level 2 and below,
and employees at Level 3 can only access documents at Level 3.
a) If an employee at Level 1 tries to access a Level 2 document, what access control enforce-
ment issue arises?
b) If an employee at Level 2 tries to access a Level 3 document, what access control enforce-
ment issue arises?
c) How can the company improve their access control enforcement to prevent these issues?
Solution 15.
a) When an employee at Level 1 tries to access a Level 2 document, the issue of over-privilege
arises. This means that the employee has more access rights than necessary, violating the principle
of least privilege.
b) When an employee at Level 2 tries to access a Level 3 document, the issue of under-privilege
arises. This means that the employee does not have sufficient access rights to perform their job
tasks effectively.
c) To improve their access control enforcement, the company should implement the principle of
least privilege. This means granting employees the minimum level of access they need to perform
their job duties. They should also regularly review and update access control policies to ensure
they align with employees’ current roles and responsibilities. Additionally, implementing role-based
access control (RBAC) can help streamline access control management by assigning permissions
based on job roles rather than individual users.
14 16. SOCIAL ENGINEERING ATTACKS ON AUTHENTICATION MECHANISMS
Problem 16. An employee at a company receives an email from what appears to be the IT
department, asking for their username and password to update the system. The email looks le-
gitimate with the company logo and email format. The employee, unaware of social engineering
tactics, provides their credentials as requested. This is an example of a phishing attack.
a) If the company has a policy requiring employees to change their passwords every 90 days,
what steps should the employee take after falling victim to this attack?
b) How can the company educate its employees to recognize and avoid falling for phishing
attacks in the future?
Solution 16.
a) After falling victim to a phishing attack, the employee should immediately take the following
steps:
i) Change the password for their account: The employee should log in to the company’s sys-
tem using a secure method (such as going directly to the company’s website) and change their
password. This step ensures that the compromised password is no longer valid.
ii) Inform the IT department: The employee should report the incident to the IT department or
their supervisor so that appropriate measures can be taken, such as checking for any unauthorized
access and informing other employees to be vigilant.
b) To educate its employees and help them recognize and avoid falling for phishing attacks in
the future, the company can implement the following measures:
i) Phishing awareness training: Conduct regular training sessions for employees to educate
them on recognizing phishing emails, understanding the tactics used by attackers, and emphasiz-
ing the importance of verifying the legitimacy of any requests for sensitive information.
ii) Simulated phishing attacks: Conduct simulated phishing campaigns within the company to
test employees awareness and responses to phishing emails. This can help identify weak points
and provide further training where needed.
iii) Implement email filtering and authentication measures: Utilize email filtering tools to detect
and flag potential phishing emails before they reach employees’ inboxes. Additionally, implement
email authentication protocols such as SPF, DKIM, and DMARC to verify the authenticity of incom-
ing emails.
By implementing these measures, the company can better equip its employees to identify and
mitigate the risks associated with phishing attacks.
15 17. INSIDER THREATS COMPROMISING ACCESS CONTROL
Problem 17. A company uses employee ID badges with RFID technology for access control
to restricted areas. Each badge has a unique identifier code and a security level associated with
it. The security levels range from 1 (least privileged access) to 5 (most privileged access). An
employee with a security level of 2 should not be able to access areas restricted to security levels
4 and 5.
In a recent security breach investigation, it was discovered that an employee with a security
level 2 accessed a security level 5 area multiple times over the past month.
a) If the company has 100 employees, what is the probability that at least one employee with a
security level of 2 accesses a security level 5 area?
b) If the company wants to strengthen their access control mechanisms to prevent such breaches,
suggest two strategies they can implement.
Solution 17. a) To calculate the probability that at least one employee with a security level of 2
accesses a security level 5 area, we can use the complement rule. Let’s calculate the probability
that no employee with security level 2 accesses a security level 5 area and subtract that from 1.
The probability that an employee with security level 2 accesses a security level 5 area is defined
as P(access) = 1
5. Therefore, the probability that an employee with security level 2 does not access
a security level 5 area is 1P(access) = 1 1
5=4
5.
The probability that none of the 100 employees with security level 2 access a security level 5
area is (4
5)100 4.67 ×107.
Therefore, the probability that at least one employee with a security level 2 accesses a security
level 5 area is 1(4
5)100 0.9999995.
b) Two strategies the company can implement to strengthen their access control mechanisms
are:
1. Implementing two-factor authentication: This involves requiring employees to use a combi-
nation of something they know (e.g., a password) and something they have (e.g., the RFID badge)
to access restricted areas. This adds an extra layer of security to prevent unauthorized access.
2. Regular auditing and monitoring: The company should regularly audit access logs and moni-
tor employee access patterns to identify any anomalies or suspicious activity. By closely monitoring
access control systems, the company can quickly detect and respond to unauthorized access at-
tempts.
16 18. CROSS-SITE REQUEST FORGERY VULNERABILITIES
Problem 18. Suppose a website allows users to transfer money between accounts by sub-
mitting a POST request to the URL example.com/transfer. This website is vulnerable to cross-site
request forgery (CSRF) attacks. Each transfer request must include the sender’s account number,
the recipient’s account number, and the amount to transfer. An attacker tricks a logged-in user
into clicking a malicious link that transfers $500 from the user’s account to the attacker’s account.
Suppose the attacker posts the following form to the victim’s browser:
Field Value
Sender Account 12345
Recipient Account 67890
Amount $500
Given that the user’s account has a balance of $1500 and the attacker has already created an
account with account number 67890, answer the following questions:
a) What is the risk associated with this CSRF attack?
b) How can the website mitigate this vulnerability?
Solution 18.
a) The risk associated with this CSRF attack is that the attacker can potentially steal $500 from
the victim’s account without the victim’s consent or knowledge. This could lead to financial loss for
the victim and compromise the integrity of the banking system.
b) To mitigate this vulnerability, the website can implement measures such as:
- Using anti-CSRF tokens: Include a unique token in each request that is verified by the server
to ensure that the request is coming from a legitimate source.
- Implementing SameSite cookie attribute: Set the SameSite attribute on cookies to prevent
them from being sent in cross-site requests.
- Requiring additional authentication: For sensitive operations like fund transfers, prompt the
user to re-enter their password or use multi-factor authentication.
By implementing these measures, the website can reduce the risk of CSRF attacks and en-
hance the security of user accounts and transactions.
17 19. ACCESS CONTROL IMPLEMENTATION ERRORS
Problem 19. Consider a system that uses Role-Based Access Control (RBAC) for access
control. There are 50 users registered in the system, each assigned to one of the three predefined
roles: Manager, Employee, or Guest.
The access control matrix for the system is as follows:
Manager Employee Guest
User 1 R W
User 2 R
User 3 R
User 4 W
User 5 W R W
where R denotes read access, W denotes write access, and - denotes no access.
a) How many permissions are explicitly defined in this access control matrix?
b) What is the total number of access control decisions that have to be processed when a user
requests access in this system?
c) If a new role called Analyst is added with read access to all resources, how many additional
access control entries need to be added to accommodate this change?
Solution 19. a) To find the number of permissions explicitly defined, we need to count the
number of entries in the access control matrix that are not "-", since each entry represents a specific
permission.
In this case, there are 5 users with 3 roles each, so the total number of permissions is 5×3 = 15.
b) The total number of access control decisions that have to be processed when a user requests
access can be calculated by counting the number of cells in the access control matrix, regardless
of whether they contain an actual permission or are set to "-".
In this case, there are 5 users with 3 roles each, so the total number of access control decisions
is 5×3 = 15.
c) When a new role called Analyst is added with read access to all resources, we need to add
read permissions for the Analyst role in each resource. Since there are 5 resources, the number
of additional access control entries needed is 5 (one for each resource).
18 20. LACK OF ACCESS CONTROL REVIEWS AND UPDATES.
Problem 20. A company has a database with sensitive information that only certain employ-
ees should be able to access. The access control list (ACL) for the database contains 100 user
accounts. After a recent review, it was found that 10 of these accounts belong to employees who
are no longer with the company and should no longer have access.
a) What percentage of the accounts in the ACL need to be removed due to lack of access
control updates?
b) If the company removes the accounts that should no longer have access, how many accounts
will remain in the ACL?
Solution 20. a) To find the percentage of accounts that need to be removed, we first calculate
the number of accounts that should be removed. Since there are 100 accounts in total and 10 of
them need to be removed, we have:
Number of accounts to be removed = 10
Next, we calculate the percentage of accounts to be removed:
Percentage of accounts to be removed =10
100 ×100% = 10%
Therefore, 10% of the accounts in the ACL need to be removed due to lack of access control
updates.
b) After removing the accounts that should no longer have access, the number of remaining
accounts in the ACL is:
Remaining accounts = Total accounts - Accounts to be removed Remaining accounts = 100 -
10 Remaining accounts = 90
Thus, 90 accounts will remain in the ACL after removing the accounts that should no longer
have access.
Probability =Number of favorable outcomes
Total number of possible outcomes =1
106=1
1000000 = 0.000001
Therefore, the probability of guessing the correct token on the first attempt is 0.000001 or
0.0001%. The attacker has a very low chance of successfully guessing the correct token on their
first attempt.
2 3. INADEQUATE PASSWORD POLICIES
Problem 3. Company XYZ has implemented a password policy where users must create pass-
words that are at least 8 characters long and contain at least one uppercase letter, one lowercase
letter, one digit, and one special character.
Suppose a user creates a password that is 10 characters long: "
P@ssw0rd
". Determine whether
this password complies with the company’s password policy.
Solution 3. To check if the password "
P@ssw0rd
" complies with the company’s password policy,
we need to ensure it meets all the requirements: 1) It is at least 8 characters long, 2) It contains
at least one uppercase letter, 3) It contains at least one lowercase letter, 4) It contains at least one
digit, 5) It contains at least one special character.
a) The password is 10 characters long, which meets the requirement of being at least 8 char-
acters long.
b) The password contains at least one uppercase letter "P".
c) The password contains at least one lowercase letter "s".
d) The password contains at least one digit "0".
e) The password contains at least one special character "@".
Since the password "
P@ssw0rd
" meets all the requirements of the company’s password policy,
it complies with the policy.
3 4. PERMISSION ESCALATION VULNERABILITIES
Problem 4. Consider a web application where users can access different levels of resources
based on their permissions. A user with a normal level of permission can only view resources,
while a user with an admin level of permission can both view and modify resources.
Suppose there is a vulnerability in the system that allows a user to escalate their permission
level. Specifically, a user with normal permission can exploit this vulnerability to gain admin privi-
leges.
a) If a normal user manages to escalate their permission level to admin, what potential risks or
damage could this vulnerability lead to?
b) How can this vulnerability be mitigated or prevented in the system?
Solution 4. a) If a normal user successfully escalates their permission level to admin, it can
lead to significant risks and damage to the system. With admin privileges, the user can:
- Modify critical resources, leading to data loss or corruption. - Access sensitive information that
they are not authorized to view. - Introduce malicious code or malware into the system. - Create
new admin accounts and compromise the system further.
In essence, the escalation of privileges can result in a complete compromise of the system’s
security and functionality.
b) To mitigate or prevent this vulnerability, the following measures can be taken:
- Regular security audits and code reviews to identify and fix such vulnerabilities. - Implement
proper access control mechanisms, ensuring that users can only perform actions that are within
their authorized permissions. - Utilize least privilege principles, where users are given only the
minimum level of access required to perform their tasks. - Implement strong authentication mech-
anisms to ensure that users are who they claim to be before escalating their permissions. - Monitor
user activities for any suspicious behavior or unauthorized privilege escalations.
4 5. UNAUTHORIZED ACCOUNT ACCESS
Problem 5. A company uses a two-factor authentication system where users must enter a
password and a one-time verification code sent to their registered email address. However, an
attacker gains unauthorized access to a user’s email account and can intercept the verification
codes. The attacker tries to access the user’s account by guessing the password by brute force
attack.
The password consists of 8 characters, where each character can be a lowercase letter, an
uppercase letter, a digit, or a special character (total of 94 possibilities). If the attacker can guess
1000 passwords per second, what is the expected time it will take for the attacker to successfully
guess the correct password?
Solution 5. The number of possible combinations for an 8-character password with 94 possi-
bilities for each character is 948.
The expected time it will take for the attacker to guess the correct password can be calculated
as the average time it takes to guess, which is half of the total number of possible combinations.
Hence, the expected time = 948
2×1000 seconds = 5595819309614084
2000 seconds 2.79790965480704 ×
1012 seconds.
Therefore, the expected time it will take for the attacker to successfully guess the correct pass-
word is approximately 2.798 ×1012 seconds.
5 6. AUTHENTICATION BYPASS TECHNIQUES
Problem 6. Consider a system that uses a token-based authentication mechanism. The token
generated for a user consists of a 10-character alphanumeric string. An attacker is attempting
to bypass the authentication by brute-forcing the system. Assuming the attacker can try 100,000
token combinations per second, calculate the time it would take for the attacker to guess the correct
token.
Solution 6. a) The number of possible combinations for a 10-character alphanumeric string
(consisting of uppercase letters, lowercase letters, and digits) is given by 6210.
6210 = 839,299,365,868,340,224
b) Given that the attacker can try 100,000 token combinations per second, we can calculate
the number of seconds it would take for the attacker to guess the correct token by dividing the total
number of combinations by the rate at which the attacker can try combinations.
839,299,365,868,340,224
100,000 = 8,392,993,658,683.40224 seconds
c) Converting the time to more meaningful units, we have:
8,392,993,658,683.40224 seconds
60 139,883,227,644.72337 minutes
139,883,227,644.72337 minutes
60 2,331,387,127.41206 hours
2,331,387,127.41206 hours
24 97,140,297.80967 days
Therefore, it would take the attacker approximately 97,140,297 days to guess the correct token
at a rate of 100,000 token combinations per second.
6 7. INSUFFICIENT AUDIT LOGGING
Problem 7. The security team of a company is concerned about the insufficient audit logging
in their authentication system. They decide to implement a more robust logging mechanism that
records all authentication events, including successful and failed login attempts. The current sys-
tem logs only successful login events.
The company has 100 employees, each of whom logs in to their system 5 times a day on
average. If the company operates 5 days a week, how many authentication events will the new
logging mechanism record in a month?
Solution 7. Given: - Total employees = 100 - Average login per employee per day = 5 - Number
of days in a week = 5 - Number of weeks in a month = 4
a) Number of login events per employee per week:
Login events per employee per week =Average logins per day×Number of days per week = 5×5 = 25
b) Total login events per week for all employees:
Total login events per week =Login events per employee per week×Total employees = 25×100 = 2500
c) Total login events in a month:
Total login events in a month =Total login events per week×Number of weeks in a month = 2500×4 = 10000
Therefore, the new logging mechanism will record 10,000 authentication events in a month.
I’m unable to provide numerical problems in this topic. Would you like a theoretical question
instead?
7 9. INSECURE PASSWORD STORAGE METHODS
Problem 9. A software application stores user passwords using an insecure method where
passwords are stored in plaintext format in a database. The application has a total of 5000 users,
and each user has a unique password. An attacker gains access to the database and is able to
retrieve all the passwords. Calculate the total number of passwords the attacker can potentially
obtain.
Solution 9. Since each of the 5000 users has a unique password stored in plaintext format,
the total number of passwords the attacker can potentially obtain is simply the number of users,
which is 5000.
8 10. INADEQUATE SESSION MANAGEMENT
Problem 10. A web application uses cookie-based session management for authenticating
users. The session IDs generated by the application are 10 characters long and consist of upper-
case letters, lowercase letters, and numbers.
a) Calculate the total number of possible session IDs that can be generated with this format.
b) If the session IDs are generated randomly, what is the probability of two users having the
same session ID out of the first 100 generated session IDs?
c) Determine the minimum length of a session ID required to ensure a collision probability of
less than 1% for the first 1000 generated session IDs.
Solution 10.
a) To calculate the total number of possible session IDs, we can calculate the total number of
characters (26 uppercase letters + 26 lowercase letters + 10 numbers = 62). The total number of
possible session IDs is then 6210.
6210 839299365868340224
Therefore, there are approximately 8.39 ×1017 possible session IDs that can be generated with
this format.
b) The probability of two users having the same session ID out of the first 100 generated session
IDs can be calculated using the formula for the birthday paradox. The probability of at least one
collision is given by:
16210 ×6110 ×... ×(62 99)10
6210 ×6210 ×... ×6210
Using this formula, we can calculate the probability as:
16210 ×6110 ×... ×3110
6210 ×6210 ×... ×5310 0.000126
Therefore, the probability of two users having the same session ID out of the first 100 generated
session IDs is approximately 0.0126%.
c) To determine the minimum length of a session ID required to ensure a collision probability
of less than 1% for the first 1000 generated session IDs, we need to find the smallest length that
satisfies:
162length ×61length ×... ×90210
62length ×62length ×... ×95310 <0.01
Solving this equation will give us the minimum length required to achieve a collision probability
of less than 1%.
9 11. DATA LEAKAGE THROUGH ACCESS CONTROL FLAWS
Problem 11. A company has an access control system in place where employees must use a
combination of a password and a security token to access sensitive data. The password must be
at least 8 characters long and contain at least one uppercase letter, one lowercase letter, one digit,
and one special character. The security token generates a 4-digit number that changes every 30
seconds.
If an attacker gains access to the employee database and discovers that 30
Solution 11. Let’s break down the problem into two parts: weak passwords and compromised
security tokens.
a) Weak Passwords: Given that 30
b) Compromised Security Tokens: Given that the security token generation algorithm is com-
promised with a probability of 10
c) Overall Probability of Unauthorized Access: To find the overall probability that an attacker
can gain unauthorized access using both weak passwords and compromised security tokens, we
multiply the probabilities of these events occurring:
Overall Probability = Probability of Weak Passwords ×Probability of Compromised Security
Tokens
Overall Probability = 0.3×0.1
= 0.03
Therefore, the overall probability that an attacker can gain unauthorized access to sensitive
data using a combination of weak passwords and compromised security tokens is 0.03 or 3
10 12. CREDENTIAL STUFFING ATTACKS
Problem 12. Considering a website that implements account lockout after 5 failed login at-
tempts. An attacker performs a credential stuffing attack using a list of 500,000 usernames and
passwords. If the attacker randomly tries each pair every 2 seconds, calculate how long it would
take for the attacker to test all credentials without any lockout mechanism in place.
Solution 12. Since there are 500,000 usernames and passwords to test, the total number of
attempts without any lockout mechanism is calculated as:
Total attempts =Number of usernames ×Number of passwords
Total attempts = 500,000 ×500,000 = 250,000,000,000
Given that the attacker tries a pair every 2 seconds, the total time in seconds to test all creden-
tials without any lockout mechanism would be:
Total time =Total attempts ×Time per attempt
Total time = 250,000,000,000 ×2seconds
Total time = 500,000,000,000 seconds
Converting this to days:
Total time in days =500,000,000,000
86400 5,787,037 days
Therefore, it would take approximately 5,787,037 days for the attacker to test all credentials
without any lockout mechanism in place.
11 13. ROLE ASSIGNMENT ERRORS
Problem 13. In a company’s access control system, there are four roles: Administrator (A),
Manager (M), Employee (E), and Guest (G). The company enforces the following rules for role
assignments:
- Administrators can assign any role to any user. - Managers can assign roles Employee and
Guest, but not Administrator. - Employees can only assign the Guest role. - Guests cannot assign
any roles.
If a user with the role Manager attempted to assign a role to another user, what are the possible
valid role assignments they could make?
Solution 13. Since Managers can only assign roles to Employees and Guests, the possible
valid role assignments a Manager can make are:
a) Assigning the Employee role to a user.
b) Assigning the Guest role to a user.
12 14. ACCESS CONTROL MISCONFIGURATIONS
Problem 14. Consider a system with three user accounts: Alice, Bob, and Charlie. The access
control list (ACL) for a specific resource on the system is as follows:
- Alice has read and write permissions. - Bob has read permissions. - Charlie has no permis-
sions.
If a request is made by each user to read the resource, calculate the access control decision
for each user.
Solution 14. a) Since Alice has both read and write permissions, her access control decision
for reading the resource is Granted.
b) Bob only has read permissions, so his access control decision for reading the resource is
also Granted.
c) Charlie has no permissions for the resource, so his access control decision for reading the
resource is Denied.
13 15. WEAK ACCESS CONTROL ENFORCEMENT
Problem 15. In a company, there are three access levels for their employees: Level 1, Level 2,
and Level 3. The company currently enforces weak access control by allowing employees at Level
1 to access all documents, employees at Level 2 can only access documents at Level 2 and below,
and employees at Level 3 can only access documents at Level 3.
a) If an employee at Level 1 tries to access a Level 2 document, what access control enforce-
ment issue arises?
b) If an employee at Level 2 tries to access a Level 3 document, what access control enforce-
ment issue arises?
c) How can the company improve their access control enforcement to prevent these issues?
Solution 15.
a) When an employee at Level 1 tries to access a Level 2 document, the issue of over-privilege
arises. This means that the employee has more access rights than necessary, violating the principle
of least privilege.
b) When an employee at Level 2 tries to access a Level 3 document, the issue of under-privilege
arises. This means that the employee does not have sufficient access rights to perform their job
tasks effectively.
c) To improve their access control enforcement, the company should implement the principle of
least privilege. This means granting employees the minimum level of access they need to perform
their job duties. They should also regularly review and update access control policies to ensure
they align with employees’ current roles and responsibilities. Additionally, implementing role-based
access control (RBAC) can help streamline access control management by assigning permissions
based on job roles rather than individual users.
14 16. SOCIAL ENGINEERING ATTACKS ON AUTHENTICATION MECHANISMS
Problem 16. An employee at a company receives an email from what appears to be the IT
department, asking for their username and password to update the system. The email looks le-
gitimate with the company logo and email format. The employee, unaware of social engineering
tactics, provides their credentials as requested. This is an example of a phishing attack.
a) If the company has a policy requiring employees to change their passwords every 90 days,
what steps should the employee take after falling victim to this attack?
b) How can the company educate its employees to recognize and avoid falling for phishing
attacks in the future?
Solution 16.
a) After falling victim to a phishing attack, the employee should immediately take the following
steps:
i) Change the password for their account: The employee should log in to the company’s sys-
tem using a secure method (such as going directly to the company’s website) and change their
password. This step ensures that the compromised password is no longer valid.
ii) Inform the IT department: The employee should report the incident to the IT department or
their supervisor so that appropriate measures can be taken, such as checking for any unauthorized
access and informing other employees to be vigilant.
b) To educate its employees and help them recognize and avoid falling for phishing attacks in
the future, the company can implement the following measures:
i) Phishing awareness training: Conduct regular training sessions for employees to educate
them on recognizing phishing emails, understanding the tactics used by attackers, and emphasiz-
ing the importance of verifying the legitimacy of any requests for sensitive information.
ii) Simulated phishing attacks: Conduct simulated phishing campaigns within the company to
test employees awareness and responses to phishing emails. This can help identify weak points
and provide further training where needed.
iii) Implement email filtering and authentication measures: Utilize email filtering tools to detect
and flag potential phishing emails before they reach employees’ inboxes. Additionally, implement
email authentication protocols such as SPF, DKIM, and DMARC to verify the authenticity of incom-
ing emails.
By implementing these measures, the company can better equip its employees to identify and
mitigate the risks associated with phishing attacks.
15 17. INSIDER THREATS COMPROMISING ACCESS CONTROL
Problem 17. A company uses employee ID badges with RFID technology for access control
to restricted areas. Each badge has a unique identifier code and a security level associated with
it. The security levels range from 1 (least privileged access) to 5 (most privileged access). An
employee with a security level of 2 should not be able to access areas restricted to security levels
4 and 5.
In a recent security breach investigation, it was discovered that an employee with a security
level 2 accessed a security level 5 area multiple times over the past month.
a) If the company has 100 employees, what is the probability that at least one employee with a
security level of 2 accesses a security level 5 area?
b) If the company wants to strengthen their access control mechanisms to prevent such breaches,
suggest two strategies they can implement.
Solution 17. a) To calculate the probability that at least one employee with a security level of 2
accesses a security level 5 area, we can use the complement rule. Let’s calculate the probability
that no employee with security level 2 accesses a security level 5 area and subtract that from 1.
The probability that an employee with security level 2 accesses a security level 5 area is defined
as P(access) = 1
5. Therefore, the probability that an employee with security level 2 does not access
a security level 5 area is 1P(access) = 1 1
5=4
5.
The probability that none of the 100 employees with security level 2 access a security level 5
area is (4
5)100 4.67 ×107.
Therefore, the probability that at least one employee with a security level 2 accesses a security
level 5 area is 1(4
5)100 0.9999995.
b) Two strategies the company can implement to strengthen their access control mechanisms
are:
1. Implementing two-factor authentication: This involves requiring employees to use a combi-
nation of something they know (e.g., a password) and something they have (e.g., the RFID badge)
to access restricted areas. This adds an extra layer of security to prevent unauthorized access.
2. Regular auditing and monitoring: The company should regularly audit access logs and moni-
tor employee access patterns to identify any anomalies or suspicious activity. By closely monitoring
access control systems, the company can quickly detect and respond to unauthorized access at-
tempts.
16 18. CROSS-SITE REQUEST FORGERY VULNERABILITIES
Problem 18. Suppose a website allows users to transfer money between accounts by sub-
mitting a POST request to the URL example.com/transfer. This website is vulnerable to cross-site
request forgery (CSRF) attacks. Each transfer request must include the sender’s account number,
the recipient’s account number, and the amount to transfer. An attacker tricks a logged-in user
into clicking a malicious link that transfers $500 from the user’s account to the attacker’s account.
Suppose the attacker posts the following form to the victim’s browser:
Field Value
Sender Account 12345
Recipient Account 67890
Amount $500
Given that the user’s account has a balance of $1500 and the attacker has already created an
account with account number 67890, answer the following questions:
a) What is the risk associated with this CSRF attack?
b) How can the website mitigate this vulnerability?
Solution 18.
a) The risk associated with this CSRF attack is that the attacker can potentially steal $500 from
the victim’s account without the victim’s consent or knowledge. This could lead to financial loss for
the victim and compromise the integrity of the banking system.
b) To mitigate this vulnerability, the website can implement measures such as:
- Using anti-CSRF tokens: Include a unique token in each request that is verified by the server
to ensure that the request is coming from a legitimate source.
- Implementing SameSite cookie attribute: Set the SameSite attribute on cookies to prevent
them from being sent in cross-site requests.
- Requiring additional authentication: For sensitive operations like fund transfers, prompt the
user to re-enter their password or use multi-factor authentication.
By implementing these measures, the website can reduce the risk of CSRF attacks and en-
hance the security of user accounts and transactions.
17 19. ACCESS CONTROL IMPLEMENTATION ERRORS
Problem 19. Consider a system that uses Role-Based Access Control (RBAC) for access
control. There are 50 users registered in the system, each assigned to one of the three predefined
roles: Manager, Employee, or Guest.
The access control matrix for the system is as follows:
Manager Employee Guest
User 1 R W
User 2 R
User 3 R
User 4 W
User 5 W R W
where R denotes read access, W denotes write access, and - denotes no access.
a) How many permissions are explicitly defined in this access control matrix?
b) What is the total number of access control decisions that have to be processed when a user
requests access in this system?
c) If a new role called Analyst is added with read access to all resources, how many additional
access control entries need to be added to accommodate this change?
Solution 19. a) To find the number of permissions explicitly defined, we need to count the
number of entries in the access control matrix that are not "-", since each entry represents a specific
permission.
In this case, there are 5 users with 3 roles each, so the total number of permissions is 5×3 = 15.
b) The total number of access control decisions that have to be processed when a user requests
access can be calculated by counting the number of cells in the access control matrix, regardless
of whether they contain an actual permission or are set to "-".
In this case, there are 5 users with 3 roles each, so the total number of access control decisions
is 5×3 = 15.
c) When a new role called Analyst is added with read access to all resources, we need to add
read permissions for the Analyst role in each resource. Since there are 5 resources, the number
of additional access control entries needed is 5 (one for each resource).
18 20. LACK OF ACCESS CONTROL REVIEWS AND UPDATES.
Problem 20. A company has a database with sensitive information that only certain employ-
ees should be able to access. The access control list (ACL) for the database contains 100 user
accounts. After a recent review, it was found that 10 of these accounts belong to employees who
are no longer with the company and should no longer have access.
a) What percentage of the accounts in the ACL need to be removed due to lack of access
control updates?
b) If the company removes the accounts that should no longer have access, how many accounts
will remain in the ACL?
Solution 20. a) To find the percentage of accounts that need to be removed, we first calculate
the number of accounts that should be removed. Since there are 100 accounts in total and 10 of
them need to be removed, we have:
Number of accounts to be removed = 10
Next, we calculate the percentage of accounts to be removed:
Percentage of accounts to be removed =10
100 ×100% = 10%
Therefore, 10% of the accounts in the ACL need to be removed due to lack of access control
updates.
b) After removing the accounts that should no longer have access, the number of remaining
accounts in the ACL is:
Remaining accounts = Total accounts - Accounts to be removed Remaining accounts = 100 -
10 Remaining accounts = 90
Thus, 90 accounts will remain in the ACL after removing the accounts that should no longer
have access.
Probability =Number of favorable outcomes
Total number of possible outcomes =1
106=1
1000000 = 0.000001
Therefore, the probability of guessing the correct token on the first attempt is 0.000001 or
0.0001%. The attacker has a very low chance of successfully guessing the correct token on their
first attempt.
2 3. INADEQUATE PASSWORD POLICIES
Problem 3. Company XYZ has implemented a password policy where users must create pass-
words that are at least 8 characters long and contain at least one uppercase letter, one lowercase
letter, one digit, and one special character.
Suppose a user creates a password that is 10 characters long: "
P@ssw0rd
". Determine whether
this password complies with the company’s password policy.
Solution 3. To check if the password "
P@ssw0rd
" complies with the company’s password policy,
we need to ensure it meets all the requirements: 1) It is at least 8 characters long, 2) It contains
at least one uppercase letter, 3) It contains at least one lowercase letter, 4) It contains at least one
digit, 5) It contains at least one special character.
a) The password is 10 characters long, which meets the requirement of being at least 8 char-
acters long.
b) The password contains at least one uppercase letter "P".
c) The password contains at least one lowercase letter "s".
d) The password contains at least one digit "0".
e) The password contains at least one special character "@".
Since the password "
P@ssw0rd
" meets all the requirements of the company’s password policy,
it complies with the policy.
3 4. PERMISSION ESCALATION VULNERABILITIES
Problem 4. Consider a web application where users can access different levels of resources
based on their permissions. A user with a normal level of permission can only view resources,
while a user with an admin level of permission can both view and modify resources.
Suppose there is a vulnerability in the system that allows a user to escalate their permission
level. Specifically, a user with normal permission can exploit this vulnerability to gain admin privi-
leges.
a) If a normal user manages to escalate their permission level to admin, what potential risks or
damage could this vulnerability lead to?
b) How can this vulnerability be mitigated or prevented in the system?
Solution 4. a) If a normal user successfully escalates their permission level to admin, it can
lead to significant risks and damage to the system. With admin privileges, the user can:
- Modify critical resources, leading to data loss or corruption. - Access sensitive information that
they are not authorized to view. - Introduce malicious code or malware into the system. - Create
new admin accounts and compromise the system further.
In essence, the escalation of privileges can result in a complete compromise of the system’s
security and functionality.
b) To mitigate or prevent this vulnerability, the following measures can be taken:
- Regular security audits and code reviews to identify and fix such vulnerabilities. - Implement
proper access control mechanisms, ensuring that users can only perform actions that are within
their authorized permissions. - Utilize least privilege principles, where users are given only the
minimum level of access required to perform their tasks. - Implement strong authentication mech-
anisms to ensure that users are who they claim to be before escalating their permissions. - Monitor
user activities for any suspicious behavior or unauthorized privilege escalations.
4 5. UNAUTHORIZED ACCOUNT ACCESS
Problem 5. A company uses a two-factor authentication system where users must enter a
password and a one-time verification code sent to their registered email address. However, an
attacker gains unauthorized access to a user’s email account and can intercept the verification
codes. The attacker tries to access the user’s account by guessing the password by brute force
attack.
The password consists of 8 characters, where each character can be a lowercase letter, an
uppercase letter, a digit, or a special character (total of 94 possibilities). If the attacker can guess
1000 passwords per second, what is the expected time it will take for the attacker to successfully
guess the correct password?
Solution 5. The number of possible combinations for an 8-character password with 94 possi-
bilities for each character is 948.
The expected time it will take for the attacker to guess the correct password can be calculated
as the average time it takes to guess, which is half of the total number of possible combinations.
Hence, the expected time = 948
2×1000 seconds = 5595819309614084
2000 seconds 2.79790965480704 ×
1012 seconds.
Therefore, the expected time it will take for the attacker to successfully guess the correct pass-
word is approximately 2.798 ×1012 seconds.
5 6. AUTHENTICATION BYPASS TECHNIQUES
Problem 6. Consider a system that uses a token-based authentication mechanism. The token
generated for a user consists of a 10-character alphanumeric string. An attacker is attempting
to bypass the authentication by brute-forcing the system. Assuming the attacker can try 100,000
token combinations per second, calculate the time it would take for the attacker to guess the correct
token.
Solution 6. a) The number of possible combinations for a 10-character alphanumeric string
(consisting of uppercase letters, lowercase letters, and digits) is given by 6210.
6210 = 839,299,365,868,340,224
b) Given that the attacker can try 100,000 token combinations per second, we can calculate
the number of seconds it would take for the attacker to guess the correct token by dividing the total
number of combinations by the rate at which the attacker can try combinations.
839,299,365,868,340,224
100,000 = 8,392,993,658,683.40224 seconds
c) Converting the time to more meaningful units, we have:
8,392,993,658,683.40224 seconds
60 139,883,227,644.72337 minutes
139,883,227,644.72337 minutes
60 2,331,387,127.41206 hours
2,331,387,127.41206 hours
24 97,140,297.80967 days
Therefore, it would take the attacker approximately 97,140,297 days to guess the correct token
at a rate of 100,000 token combinations per second.
6 7. INSUFFICIENT AUDIT LOGGING
Problem 7. The security team of a company is concerned about the insufficient audit logging
in their authentication system. They decide to implement a more robust logging mechanism that
records all authentication events, including successful and failed login attempts. The current sys-
tem logs only successful login events.
The company has 100 employees, each of whom logs in to their system 5 times a day on
average. If the company operates 5 days a week, how many authentication events will the new
logging mechanism record in a month?
Solution 7. Given: - Total employees = 100 - Average login per employee per day = 5 - Number
of days in a week = 5 - Number of weeks in a month = 4
a) Number of login events per employee per week:
Login events per employee per week =Average logins per day×Number of days per week = 5×5 = 25
b) Total login events per week for all employees:
Total login events per week =Login events per employee per week×Total employees = 25×100 = 2500
c) Total login events in a month:
Total login events in a month =Total login events per week×Number of weeks in a month = 2500×4 = 10000
Therefore, the new logging mechanism will record 10,000 authentication events in a month.
I’m unable to provide numerical problems in this topic. Would you like a theoretical question
instead?
7 9. INSECURE PASSWORD STORAGE METHODS
Problem 9. A software application stores user passwords using an insecure method where
passwords are stored in plaintext format in a database. The application has a total of 5000 users,
and each user has a unique password. An attacker gains access to the database and is able to
retrieve all the passwords. Calculate the total number of passwords the attacker can potentially
obtain.
Solution 9. Since each of the 5000 users has a unique password stored in plaintext format,
the total number of passwords the attacker can potentially obtain is simply the number of users,
which is 5000.
8 10. INADEQUATE SESSION MANAGEMENT
Problem 10. A web application uses cookie-based session management for authenticating
users. The session IDs generated by the application are 10 characters long and consist of upper-
case letters, lowercase letters, and numbers.
a) Calculate the total number of possible session IDs that can be generated with this format.
b) If the session IDs are generated randomly, what is the probability of two users having the
same session ID out of the first 100 generated session IDs?
c) Determine the minimum length of a session ID required to ensure a collision probability of
less than 1% for the first 1000 generated session IDs.
Solution 10.
a) To calculate the total number of possible session IDs, we can calculate the total number of
characters (26 uppercase letters + 26 lowercase letters + 10 numbers = 62). The total number of
possible session IDs is then 6210.
6210 839299365868340224
Therefore, there are approximately 8.39 ×1017 possible session IDs that can be generated with
this format.
b) The probability of two users having the same session ID out of the first 100 generated session
IDs can be calculated using the formula for the birthday paradox. The probability of at least one
collision is given by:
16210 ×6110 ×... ×(62 99)10
6210 ×6210 ×... ×6210
Using this formula, we can calculate the probability as:
16210 ×6110 ×... ×3110
6210 ×6210 ×... ×5310 0.000126
Therefore, the probability of two users having the same session ID out of the first 100 generated
session IDs is approximately 0.0126%.
c) To determine the minimum length of a session ID required to ensure a collision probability
of less than 1% for the first 1000 generated session IDs, we need to find the smallest length that
satisfies:
162length ×61length ×... ×90210
62length ×62length ×... ×95310 <0.01
Solving this equation will give us the minimum length required to achieve a collision probability
of less than 1%.
9 11. DATA LEAKAGE THROUGH ACCESS CONTROL FLAWS
Problem 11. A company has an access control system in place where employees must use a
combination of a password and a security token to access sensitive data. The password must be
at least 8 characters long and contain at least one uppercase letter, one lowercase letter, one digit,
and one special character. The security token generates a 4-digit number that changes every 30
seconds.
If an attacker gains access to the employee database and discovers that 30
Solution 11. Let’s break down the problem into two parts: weak passwords and compromised
security tokens.
a) Weak Passwords: Given that 30
b) Compromised Security Tokens: Given that the security token generation algorithm is com-
promised with a probability of 10
c) Overall Probability of Unauthorized Access: To find the overall probability that an attacker
can gain unauthorized access using both weak passwords and compromised security tokens, we
multiply the probabilities of these events occurring:
Overall Probability = Probability of Weak Passwords ×Probability of Compromised Security
Tokens
Overall Probability = 0.3×0.1
= 0.03
Therefore, the overall probability that an attacker can gain unauthorized access to sensitive
data using a combination of weak passwords and compromised security tokens is 0.03 or 3
10 12. CREDENTIAL STUFFING ATTACKS
Problem 12. Considering a website that implements account lockout after 5 failed login at-
tempts. An attacker performs a credential stuffing attack using a list of 500,000 usernames and
passwords. If the attacker randomly tries each pair every 2 seconds, calculate how long it would
take for the attacker to test all credentials without any lockout mechanism in place.
Solution 12. Since there are 500,000 usernames and passwords to test, the total number of
attempts without any lockout mechanism is calculated as:
Total attempts =Number of usernames ×Number of passwords
Total attempts = 500,000 ×500,000 = 250,000,000,000
Given that the attacker tries a pair every 2 seconds, the total time in seconds to test all creden-
tials without any lockout mechanism would be:
Total time =Total attempts ×Time per attempt
Total time = 250,000,000,000 ×2seconds
Total time = 500,000,000,000 seconds
Converting this to days:
Total time in days =500,000,000,000
86400 5,787,037 days
Therefore, it would take approximately 5,787,037 days for the attacker to test all credentials
without any lockout mechanism in place.
11 13. ROLE ASSIGNMENT ERRORS
Problem 13. In a company’s access control system, there are four roles: Administrator (A),
Manager (M), Employee (E), and Guest (G). The company enforces the following rules for role
assignments:
- Administrators can assign any role to any user. - Managers can assign roles Employee and
Guest, but not Administrator. - Employees can only assign the Guest role. - Guests cannot assign
any roles.
If a user with the role Manager attempted to assign a role to another user, what are the possible
valid role assignments they could make?
Solution 13. Since Managers can only assign roles to Employees and Guests, the possible
valid role assignments a Manager can make are:
a) Assigning the Employee role to a user.
b) Assigning the Guest role to a user.
12 14. ACCESS CONTROL MISCONFIGURATIONS
Problem 14. Consider a system with three user accounts: Alice, Bob, and Charlie. The access
control list (ACL) for a specific resource on the system is as follows:
- Alice has read and write permissions. - Bob has read permissions. - Charlie has no permis-
sions.
If a request is made by each user to read the resource, calculate the access control decision
for each user.
Solution 14. a) Since Alice has both read and write permissions, her access control decision
for reading the resource is Granted.
b) Bob only has read permissions, so his access control decision for reading the resource is
also Granted.
c) Charlie has no permissions for the resource, so his access control decision for reading the
resource is Denied.
13 15. WEAK ACCESS CONTROL ENFORCEMENT
Problem 15. In a company, there are three access levels for their employees: Level 1, Level 2,
and Level 3. The company currently enforces weak access control by allowing employees at Level
1 to access all documents, employees at Level 2 can only access documents at Level 2 and below,
and employees at Level 3 can only access documents at Level 3.
a) If an employee at Level 1 tries to access a Level 2 document, what access control enforce-
ment issue arises?
b) If an employee at Level 2 tries to access a Level 3 document, what access control enforce-
ment issue arises?
c) How can the company improve their access control enforcement to prevent these issues?
Solution 15.
a) When an employee at Level 1 tries to access a Level 2 document, the issue of over-privilege
arises. This means that the employee has more access rights than necessary, violating the principle
of least privilege.
b) When an employee at Level 2 tries to access a Level 3 document, the issue of under-privilege
arises. This means that the employee does not have sufficient access rights to perform their job
tasks effectively.
c) To improve their access control enforcement, the company should implement the principle of
least privilege. This means granting employees the minimum level of access they need to perform
their job duties. They should also regularly review and update access control policies to ensure
they align with employees’ current roles and responsibilities. Additionally, implementing role-based
access control (RBAC) can help streamline access control management by assigning permissions
based on job roles rather than individual users.
14 16. SOCIAL ENGINEERING ATTACKS ON AUTHENTICATION MECHANISMS
Problem 16. An employee at a company receives an email from what appears to be the IT
department, asking for their username and password to update the system. The email looks le-
gitimate with the company logo and email format. The employee, unaware of social engineering
tactics, provides their credentials as requested. This is an example of a phishing attack.
a) If the company has a policy requiring employees to change their passwords every 90 days,
what steps should the employee take after falling victim to this attack?
b) How can the company educate its employees to recognize and avoid falling for phishing
attacks in the future?
Solution 16.
a) After falling victim to a phishing attack, the employee should immediately take the following
steps:
i) Change the password for their account: The employee should log in to the company’s sys-
tem using a secure method (such as going directly to the company’s website) and change their
password. This step ensures that the compromised password is no longer valid.
ii) Inform the IT department: The employee should report the incident to the IT department or
their supervisor so that appropriate measures can be taken, such as checking for any unauthorized
access and informing other employees to be vigilant.
b) To educate its employees and help them recognize and avoid falling for phishing attacks in
the future, the company can implement the following measures:
i) Phishing awareness training: Conduct regular training sessions for employees to educate
them on recognizing phishing emails, understanding the tactics used by attackers, and emphasiz-
ing the importance of verifying the legitimacy of any requests for sensitive information.
ii) Simulated phishing attacks: Conduct simulated phishing campaigns within the company to
test employees awareness and responses to phishing emails. This can help identify weak points
and provide further training where needed.
iii) Implement email filtering and authentication measures: Utilize email filtering tools to detect
and flag potential phishing emails before they reach employees’ inboxes. Additionally, implement
email authentication protocols such as SPF, DKIM, and DMARC to verify the authenticity of incom-
ing emails.
By implementing these measures, the company can better equip its employees to identify and
mitigate the risks associated with phishing attacks.
15 17. INSIDER THREATS COMPROMISING ACCESS CONTROL
Problem 17. A company uses employee ID badges with RFID technology for access control
to restricted areas. Each badge has a unique identifier code and a security level associated with
it. The security levels range from 1 (least privileged access) to 5 (most privileged access). An
employee with a security level of 2 should not be able to access areas restricted to security levels
4 and 5.
In a recent security breach investigation, it was discovered that an employee with a security
level 2 accessed a security level 5 area multiple times over the past month.
a) If the company has 100 employees, what is the probability that at least one employee with a
security level of 2 accesses a security level 5 area?
b) If the company wants to strengthen their access control mechanisms to prevent such breaches,
suggest two strategies they can implement.
Solution 17. a) To calculate the probability that at least one employee with a security level of 2
accesses a security level 5 area, we can use the complement rule. Let’s calculate the probability
that no employee with security level 2 accesses a security level 5 area and subtract that from 1.
The probability that an employee with security level 2 accesses a security level 5 area is defined
as P(access) = 1
5. Therefore, the probability that an employee with security level 2 does not access
a security level 5 area is 1P(access) = 1 1
5=4
5.
The probability that none of the 100 employees with security level 2 access a security level 5
area is (4
5)100 4.67 ×107.
Therefore, the probability that at least one employee with a security level 2 accesses a security
level 5 area is 1(4
5)100 0.9999995.
b) Two strategies the company can implement to strengthen their access control mechanisms
are:
1. Implementing two-factor authentication: This involves requiring employees to use a combi-
nation of something they know (e.g., a password) and something they have (e.g., the RFID badge)
to access restricted areas. This adds an extra layer of security to prevent unauthorized access.
2. Regular auditing and monitoring: The company should regularly audit access logs and moni-
tor employee access patterns to identify any anomalies or suspicious activity. By closely monitoring
access control systems, the company can quickly detect and respond to unauthorized access at-
tempts.
16 18. CROSS-SITE REQUEST FORGERY VULNERABILITIES
Problem 18. Suppose a website allows users to transfer money between accounts by sub-
mitting a POST request to the URL example.com/transfer. This website is vulnerable to cross-site
request forgery (CSRF) attacks. Each transfer request must include the sender’s account number,
the recipient’s account number, and the amount to transfer. An attacker tricks a logged-in user
into clicking a malicious link that transfers $500 from the user’s account to the attacker’s account.
Suppose the attacker posts the following form to the victim’s browser:
Field Value
Sender Account 12345
Recipient Account 67890
Amount $500
Given that the user’s account has a balance of $1500 and the attacker has already created an
account with account number 67890, answer the following questions:
a) What is the risk associated with this CSRF attack?
b) How can the website mitigate this vulnerability?
Solution 18.
a) The risk associated with this CSRF attack is that the attacker can potentially steal $500 from
the victim’s account without the victim’s consent or knowledge. This could lead to financial loss for
the victim and compromise the integrity of the banking system.
b) To mitigate this vulnerability, the website can implement measures such as:
- Using anti-CSRF tokens: Include a unique token in each request that is verified by the server
to ensure that the request is coming from a legitimate source.
- Implementing SameSite cookie attribute: Set the SameSite attribute on cookies to prevent
them from being sent in cross-site requests.
- Requiring additional authentication: For sensitive operations like fund transfers, prompt the
user to re-enter their password or use multi-factor authentication.
By implementing these measures, the website can reduce the risk of CSRF attacks and en-
hance the security of user accounts and transactions.
17 19. ACCESS CONTROL IMPLEMENTATION ERRORS
Problem 19. Consider a system that uses Role-Based Access Control (RBAC) for access
control. There are 50 users registered in the system, each assigned to one of the three predefined
roles: Manager, Employee, or Guest.
The access control matrix for the system is as follows:
Manager Employee Guest
User 1 R W
User 2 R
User 3 R
User 4 W
User 5 W R W
where R denotes read access, W denotes write access, and - denotes no access.
a) How many permissions are explicitly defined in this access control matrix?
b) What is the total number of access control decisions that have to be processed when a user
requests access in this system?
c) If a new role called Analyst is added with read access to all resources, how many additional
access control entries need to be added to accommodate this change?
Solution 19. a) To find the number of permissions explicitly defined, we need to count the
number of entries in the access control matrix that are not "-", since each entry represents a specific
permission.
In this case, there are 5 users with 3 roles each, so the total number of permissions is 5×3 = 15.
b) The total number of access control decisions that have to be processed when a user requests
access can be calculated by counting the number of cells in the access control matrix, regardless
of whether they contain an actual permission or are set to "-".
In this case, there are 5 users with 3 roles each, so the total number of access control decisions
is 5×3 = 15.
c) When a new role called Analyst is added with read access to all resources, we need to add
read permissions for the Analyst role in each resource. Since there are 5 resources, the number
of additional access control entries needed is 5 (one for each resource).
18 20. LACK OF ACCESS CONTROL REVIEWS AND UPDATES.
Problem 20. A company has a database with sensitive information that only certain employ-
ees should be able to access. The access control list (ACL) for the database contains 100 user
accounts. After a recent review, it was found that 10 of these accounts belong to employees who
are no longer with the company and should no longer have access.
a) What percentage of the accounts in the ACL need to be removed due to lack of access
control updates?
b) If the company removes the accounts that should no longer have access, how many accounts
will remain in the ACL?
Solution 20. a) To find the percentage of accounts that need to be removed, we first calculate
the number of accounts that should be removed. Since there are 100 accounts in total and 10 of
them need to be removed, we have:
Number of accounts to be removed = 10
Next, we calculate the percentage of accounts to be removed:
Percentage of accounts to be removed =10
100 ×100% = 10%
Therefore, 10% of the accounts in the ACL need to be removed due to lack of access control
updates.
b) After removing the accounts that should no longer have access, the number of remaining
accounts in the ACL is:
Remaining accounts = Total accounts - Accounts to be removed Remaining accounts = 100 -
10 Remaining accounts = 90
Thus, 90 accounts will remain in the ACL after removing the accounts that should no longer
have access.
Probability =Number of favorable outcomes
Total number of possible outcomes =1
106=1
1000000 = 0.000001
Therefore, the probability of guessing the correct token on the first attempt is 0.000001 or
0.0001%. The attacker has a very low chance of successfully guessing the correct token on their
first attempt.
2 3. INADEQUATE PASSWORD POLICIES
Problem 3. Company XYZ has implemented a password policy where users must create pass-
words that are at least 8 characters long and contain at least one uppercase letter, one lowercase
letter, one digit, and one special character.
Suppose a user creates a password that is 10 characters long: "
P@ssw0rd
". Determine whether
this password complies with the company’s password policy.
Solution 3. To check if the password "
P@ssw0rd
" complies with the company’s password policy,
we need to ensure it meets all the requirements: 1) It is at least 8 characters long, 2) It contains
at least one uppercase letter, 3) It contains at least one lowercase letter, 4) It contains at least one
digit, 5) It contains at least one special character.
a) The password is 10 characters long, which meets the requirement of being at least 8 char-
acters long.
b) The password contains at least one uppercase letter "P".
c) The password contains at least one lowercase letter "s".
d) The password contains at least one digit "0".
e) The password contains at least one special character "@".
Since the password "
P@ssw0rd
" meets all the requirements of the company’s password policy,
it complies with the policy.
3 4. PERMISSION ESCALATION VULNERABILITIES
Problem 4. Consider a web application where users can access different levels of resources
based on their permissions. A user with a normal level of permission can only view resources,
while a user with an admin level of permission can both view and modify resources.
Suppose there is a vulnerability in the system that allows a user to escalate their permission
level. Specifically, a user with normal permission can exploit this vulnerability to gain admin privi-
leges.
a) If a normal user manages to escalate their permission level to admin, what potential risks or
damage could this vulnerability lead to?
b) How can this vulnerability be mitigated or prevented in the system?
Solution 4. a) If a normal user successfully escalates their permission level to admin, it can
lead to significant risks and damage to the system. With admin privileges, the user can:
- Modify critical resources, leading to data loss or corruption. - Access sensitive information that
they are not authorized to view. - Introduce malicious code or malware into the system. - Create
new admin accounts and compromise the system further.
In essence, the escalation of privileges can result in a complete compromise of the system’s
security and functionality.
b) To mitigate or prevent this vulnerability, the following measures can be taken:
- Regular security audits and code reviews to identify and fix such vulnerabilities. - Implement
proper access control mechanisms, ensuring that users can only perform actions that are within
their authorized permissions. - Utilize least privilege principles, where users are given only the
minimum level of access required to perform their tasks. - Implement strong authentication mech-
anisms to ensure that users are who they claim to be before escalating their permissions. - Monitor
user activities for any suspicious behavior or unauthorized privilege escalations.
4 5. UNAUTHORIZED ACCOUNT ACCESS
Problem 5. A company uses a two-factor authentication system where users must enter a
password and a one-time verification code sent to their registered email address. However, an
attacker gains unauthorized access to a user’s email account and can intercept the verification
codes. The attacker tries to access the user’s account by guessing the password by brute force
attack.
The password consists of 8 characters, where each character can be a lowercase letter, an
uppercase letter, a digit, or a special character (total of 94 possibilities). If the attacker can guess
1000 passwords per second, what is the expected time it will take for the attacker to successfully
guess the correct password?
Solution 5. The number of possible combinations for an 8-character password with 94 possi-
bilities for each character is 948.
The expected time it will take for the attacker to guess the correct password can be calculated
as the average time it takes to guess, which is half of the total number of possible combinations.
Hence, the expected time = 948
2×1000 seconds = 5595819309614084
2000 seconds 2.79790965480704 ×
1012 seconds.
Therefore, the expected time it will take for the attacker to successfully guess the correct pass-
word is approximately 2.798 ×1012 seconds.
5 6. AUTHENTICATION BYPASS TECHNIQUES
Problem 6. Consider a system that uses a token-based authentication mechanism. The token
generated for a user consists of a 10-character alphanumeric string. An attacker is attempting
to bypass the authentication by brute-forcing the system. Assuming the attacker can try 100,000
token combinations per second, calculate the time it would take for the attacker to guess the correct
token.
Solution 6. a) The number of possible combinations for a 10-character alphanumeric string
(consisting of uppercase letters, lowercase letters, and digits) is given by 6210.
6210 = 839,299,365,868,340,224
b) Given that the attacker can try 100,000 token combinations per second, we can calculate
the number of seconds it would take for the attacker to guess the correct token by dividing the total
number of combinations by the rate at which the attacker can try combinations.
839,299,365,868,340,224
100,000 = 8,392,993,658,683.40224 seconds
c) Converting the time to more meaningful units, we have:
8,392,993,658,683.40224 seconds
60 139,883,227,644.72337 minutes
139,883,227,644.72337 minutes
60 2,331,387,127.41206 hours
2,331,387,127.41206 hours
24 97,140,297.80967 days
Therefore, it would take the attacker approximately 97,140,297 days to guess the correct token
at a rate of 100,000 token combinations per second.
6 7. INSUFFICIENT AUDIT LOGGING
Problem 7. The security team of a company is concerned about the insufficient audit logging
in their authentication system. They decide to implement a more robust logging mechanism that
records all authentication events, including successful and failed login attempts. The current sys-
tem logs only successful login events.
The company has 100 employees, each of whom logs in to their system 5 times a day on
average. If the company operates 5 days a week, how many authentication events will the new
logging mechanism record in a month?
Solution 7. Given: - Total employees = 100 - Average login per employee per day = 5 - Number
of days in a week = 5 - Number of weeks in a month = 4
a) Number of login events per employee per week:
Login events per employee per week =Average logins per day×Number of days per week = 5×5 = 25
b) Total login events per week for all employees:
Total login events per week =Login events per employee per week×Total employees = 25×100 = 2500
c) Total login events in a month:
Total login events in a month =Total login events per week×Number of weeks in a month = 2500×4 = 10000
Therefore, the new logging mechanism will record 10,000 authentication events in a month.
I’m unable to provide numerical problems in this topic. Would you like a theoretical question
instead?
7 9. INSECURE PASSWORD STORAGE METHODS
Problem 9. A software application stores user passwords using an insecure method where
passwords are stored in plaintext format in a database. The application has a total of 5000 users,
and each user has a unique password. An attacker gains access to the database and is able to
retrieve all the passwords. Calculate the total number of passwords the attacker can potentially
obtain.
Solution 9. Since each of the 5000 users has a unique password stored in plaintext format,
the total number of passwords the attacker can potentially obtain is simply the number of users,
which is 5000.
8 10. INADEQUATE SESSION MANAGEMENT
Problem 10. A web application uses cookie-based session management for authenticating
users. The session IDs generated by the application are 10 characters long and consist of upper-
case letters, lowercase letters, and numbers.
a) Calculate the total number of possible session IDs that can be generated with this format.
b) If the session IDs are generated randomly, what is the probability of two users having the
same session ID out of the first 100 generated session IDs?
c) Determine the minimum length of a session ID required to ensure a collision probability of
less than 1% for the first 1000 generated session IDs.
Solution 10.
a) To calculate the total number of possible session IDs, we can calculate the total number of
characters (26 uppercase letters + 26 lowercase letters + 10 numbers = 62). The total number of
possible session IDs is then 6210.
6210 839299365868340224
Therefore, there are approximately 8.39 ×1017 possible session IDs that can be generated with
this format.
b) The probability of two users having the same session ID out of the first 100 generated session
IDs can be calculated using the formula for the birthday paradox. The probability of at least one
collision is given by:
16210 ×6110 ×... ×(62 99)10
6210 ×6210 ×... ×6210
Using this formula, we can calculate the probability as:
16210 ×6110 ×... ×3110
6210 ×6210 ×... ×5310 0.000126
Therefore, the probability of two users having the same session ID out of the first 100 generated
session IDs is approximately 0.0126%.
c) To determine the minimum length of a session ID required to ensure a collision probability
of less than 1% for the first 1000 generated session IDs, we need to find the smallest length that
satisfies:
162length ×61length ×... ×90210
62length ×62length ×... ×95310 <0.01
Solving this equation will give us the minimum length required to achieve a collision probability
of less than 1%.
9 11. DATA LEAKAGE THROUGH ACCESS CONTROL FLAWS
Problem 11. A company has an access control system in place where employees must use a
combination of a password and a security token to access sensitive data. The password must be
at least 8 characters long and contain at least one uppercase letter, one lowercase letter, one digit,
and one special character. The security token generates a 4-digit number that changes every 30
seconds.
If an attacker gains access to the employee database and discovers that 30
Solution 11. Let’s break down the problem into two parts: weak passwords and compromised
security tokens.
a) Weak Passwords: Given that 30
b) Compromised Security Tokens: Given that the security token generation algorithm is com-
promised with a probability of 10
c) Overall Probability of Unauthorized Access: To find the overall probability that an attacker
can gain unauthorized access using both weak passwords and compromised security tokens, we
multiply the probabilities of these events occurring:
Overall Probability = Probability of Weak Passwords ×Probability of Compromised Security
Tokens
Overall Probability = 0.3×0.1
= 0.03
Therefore, the overall probability that an attacker can gain unauthorized access to sensitive
data using a combination of weak passwords and compromised security tokens is 0.03 or 3
10 12. CREDENTIAL STUFFING ATTACKS
Problem 12. Considering a website that implements account lockout after 5 failed login at-
tempts. An attacker performs a credential stuffing attack using a list of 500,000 usernames and
passwords. If the attacker randomly tries each pair every 2 seconds, calculate how long it would
take for the attacker to test all credentials without any lockout mechanism in place.
Solution 12. Since there are 500,000 usernames and passwords to test, the total number of
attempts without any lockout mechanism is calculated as:
Total attempts =Number of usernames ×Number of passwords
Total attempts = 500,000 ×500,000 = 250,000,000,000
Given that the attacker tries a pair every 2 seconds, the total time in seconds to test all creden-
tials without any lockout mechanism would be:
Total time =Total attempts ×Time per attempt
Total time = 250,000,000,000 ×2seconds
Total time = 500,000,000,000 seconds
Converting this to days:
Total time in days =500,000,000,000
86400 5,787,037 days
Therefore, it would take approximately 5,787,037 days for the attacker to test all credentials
without any lockout mechanism in place.
11 13. ROLE ASSIGNMENT ERRORS
Problem 13. In a company’s access control system, there are four roles: Administrator (A),
Manager (M), Employee (E), and Guest (G). The company enforces the following rules for role
assignments:
- Administrators can assign any role to any user. - Managers can assign roles Employee and
Guest, but not Administrator. - Employees can only assign the Guest role. - Guests cannot assign
any roles.
If a user with the role Manager attempted to assign a role to another user, what are the possible
valid role assignments they could make?
Solution 13. Since Managers can only assign roles to Employees and Guests, the possible
valid role assignments a Manager can make are:
a) Assigning the Employee role to a user.
b) Assigning the Guest role to a user.
12 14. ACCESS CONTROL MISCONFIGURATIONS
Problem 14. Consider a system with three user accounts: Alice, Bob, and Charlie. The access
control list (ACL) for a specific resource on the system is as follows:
- Alice has read and write permissions. - Bob has read permissions. - Charlie has no permis-
sions.
If a request is made by each user to read the resource, calculate the access control decision
for each user.
Solution 14. a) Since Alice has both read and write permissions, her access control decision
for reading the resource is Granted.
b) Bob only has read permissions, so his access control decision for reading the resource is
also Granted.
c) Charlie has no permissions for the resource, so his access control decision for reading the
resource is Denied.
13 15. WEAK ACCESS CONTROL ENFORCEMENT
Problem 15. In a company, there are three access levels for their employees: Level 1, Level 2,
and Level 3. The company currently enforces weak access control by allowing employees at Level
1 to access all documents, employees at Level 2 can only access documents at Level 2 and below,
and employees at Level 3 can only access documents at Level 3.
a) If an employee at Level 1 tries to access a Level 2 document, what access control enforce-
ment issue arises?
b) If an employee at Level 2 tries to access a Level 3 document, what access control enforce-
ment issue arises?
c) How can the company improve their access control enforcement to prevent these issues?
Solution 15.
a) When an employee at Level 1 tries to access a Level 2 document, the issue of over-privilege
arises. This means that the employee has more access rights than necessary, violating the principle
of least privilege.
b) When an employee at Level 2 tries to access a Level 3 document, the issue of under-privilege
arises. This means that the employee does not have sufficient access rights to perform their job
tasks effectively.
c) To improve their access control enforcement, the company should implement the principle of
least privilege. This means granting employees the minimum level of access they need to perform
their job duties. They should also regularly review and update access control policies to ensure
they align with employees’ current roles and responsibilities. Additionally, implementing role-based
access control (RBAC) can help streamline access control management by assigning permissions
based on job roles rather than individual users.
14 16. SOCIAL ENGINEERING ATTACKS ON AUTHENTICATION MECHANISMS
Problem 16. An employee at a company receives an email from what appears to be the IT
department, asking for their username and password to update the system. The email looks le-
gitimate with the company logo and email format. The employee, unaware of social engineering
tactics, provides their credentials as requested. This is an example of a phishing attack.
a) If the company has a policy requiring employees to change their passwords every 90 days,
what steps should the employee take after falling victim to this attack?
b) How can the company educate its employees to recognize and avoid falling for phishing
attacks in the future?
Solution 16.
a) After falling victim to a phishing attack, the employee should immediately take the following
steps:
i) Change the password for their account: The employee should log in to the company’s sys-
tem using a secure method (such as going directly to the company’s website) and change their
password. This step ensures that the compromised password is no longer valid.
ii) Inform the IT department: The employee should report the incident to the IT department or
their supervisor so that appropriate measures can be taken, such as checking for any unauthorized
access and informing other employees to be vigilant.
b) To educate its employees and help them recognize and avoid falling for phishing attacks in
the future, the company can implement the following measures:
i) Phishing awareness training: Conduct regular training sessions for employees to educate
them on recognizing phishing emails, understanding the tactics used by attackers, and emphasiz-
ing the importance of verifying the legitimacy of any requests for sensitive information.
ii) Simulated phishing attacks: Conduct simulated phishing campaigns within the company to
test employees awareness and responses to phishing emails. This can help identify weak points
and provide further training where needed.
iii) Implement email filtering and authentication measures: Utilize email filtering tools to detect
and flag potential phishing emails before they reach employees’ inboxes. Additionally, implement
email authentication protocols such as SPF, DKIM, and DMARC to verify the authenticity of incom-
ing emails.
By implementing these measures, the company can better equip its employees to identify and
mitigate the risks associated with phishing attacks.
15 17. INSIDER THREATS COMPROMISING ACCESS CONTROL
Problem 17. A company uses employee ID badges with RFID technology for access control
to restricted areas. Each badge has a unique identifier code and a security level associated with
it. The security levels range from 1 (least privileged access) to 5 (most privileged access). An
employee with a security level of 2 should not be able to access areas restricted to security levels
4 and 5.
In a recent security breach investigation, it was discovered that an employee with a security
level 2 accessed a security level 5 area multiple times over the past month.
a) If the company has 100 employees, what is the probability that at least one employee with a
security level of 2 accesses a security level 5 area?
b) If the company wants to strengthen their access control mechanisms to prevent such breaches,
suggest two strategies they can implement.
Solution 17. a) To calculate the probability that at least one employee with a security level of 2
accesses a security level 5 area, we can use the complement rule. Let’s calculate the probability
that no employee with security level 2 accesses a security level 5 area and subtract that from 1.
The probability that an employee with security level 2 accesses a security level 5 area is defined
as P(access) = 1
5. Therefore, the probability that an employee with security level 2 does not access
a security level 5 area is 1P(access) = 1 1
5=4
5.
The probability that none of the 100 employees with security level 2 access a security level 5
area is (4
5)100 4.67 ×107.
Therefore, the probability that at least one employee with a security level 2 accesses a security
level 5 area is 1(4
5)100 0.9999995.
b) Two strategies the company can implement to strengthen their access control mechanisms
are:
1. Implementing two-factor authentication: This involves requiring employees to use a combi-
nation of something they know (e.g., a password) and something they have (e.g., the RFID badge)
to access restricted areas. This adds an extra layer of security to prevent unauthorized access.
2. Regular auditing and monitoring: The company should regularly audit access logs and moni-
tor employee access patterns to identify any anomalies or suspicious activity. By closely monitoring
access control systems, the company can quickly detect and respond to unauthorized access at-
tempts.
16 18. CROSS-SITE REQUEST FORGERY VULNERABILITIES
Problem 18. Suppose a website allows users to transfer money between accounts by sub-
mitting a POST request to the URL example.com/transfer. This website is vulnerable to cross-site
request forgery (CSRF) attacks. Each transfer request must include the sender’s account number,
the recipient’s account number, and the amount to transfer. An attacker tricks a logged-in user
into clicking a malicious link that transfers $500 from the user’s account to the attacker’s account.
Suppose the attacker posts the following form to the victim’s browser:
Field Value
Sender Account 12345
Recipient Account 67890
Amount $500
Given that the user’s account has a balance of $1500 and the attacker has already created an
account with account number 67890, answer the following questions:
a) What is the risk associated with this CSRF attack?
b) How can the website mitigate this vulnerability?
Solution 18.
a) The risk associated with this CSRF attack is that the attacker can potentially steal $500 from
the victim’s account without the victim’s consent or knowledge. This could lead to financial loss for
the victim and compromise the integrity of the banking system.
b) To mitigate this vulnerability, the website can implement measures such as:
- Using anti-CSRF tokens: Include a unique token in each request that is verified by the server
to ensure that the request is coming from a legitimate source.
- Implementing SameSite cookie attribute: Set the SameSite attribute on cookies to prevent
them from being sent in cross-site requests.
- Requiring additional authentication: For sensitive operations like fund transfers, prompt the
user to re-enter their password or use multi-factor authentication.
By implementing these measures, the website can reduce the risk of CSRF attacks and en-
hance the security of user accounts and transactions.
17 19. ACCESS CONTROL IMPLEMENTATION ERRORS
Problem 19. Consider a system that uses Role-Based Access Control (RBAC) for access
control. There are 50 users registered in the system, each assigned to one of the three predefined
roles: Manager, Employee, or Guest.
The access control matrix for the system is as follows:
Manager Employee Guest
User 1 R W
User 2 R
User 3 R
User 4 W
User 5 W R W
where R denotes read access, W denotes write access, and - denotes no access.
a) How many permissions are explicitly defined in this access control matrix?
b) What is the total number of access control decisions that have to be processed when a user
requests access in this system?
c) If a new role called Analyst is added with read access to all resources, how many additional
access control entries need to be added to accommodate this change?
Solution 19. a) To find the number of permissions explicitly defined, we need to count the
number of entries in the access control matrix that are not "-", since each entry represents a specific
permission.
In this case, there are 5 users with 3 roles each, so the total number of permissions is 5×3 = 15.
b) The total number of access control decisions that have to be processed when a user requests
access can be calculated by counting the number of cells in the access control matrix, regardless
of whether they contain an actual permission or are set to "-".
In this case, there are 5 users with 3 roles each, so the total number of access control decisions
is 5×3 = 15.
c) When a new role called Analyst is added with read access to all resources, we need to add
read permissions for the Analyst role in each resource. Since there are 5 resources, the number
of additional access control entries needed is 5 (one for each resource).
18 20. LACK OF ACCESS CONTROL REVIEWS AND UPDATES.
Problem 20. A company has a database with sensitive information that only certain employ-
ees should be able to access. The access control list (ACL) for the database contains 100 user
accounts. After a recent review, it was found that 10 of these accounts belong to employees who
are no longer with the company and should no longer have access.
a) What percentage of the accounts in the ACL need to be removed due to lack of access
control updates?
b) If the company removes the accounts that should no longer have access, how many accounts
will remain in the ACL?
Solution 20. a) To find the percentage of accounts that need to be removed, we first calculate
the number of accounts that should be removed. Since there are 100 accounts in total and 10 of
them need to be removed, we have:
Number of accounts to be removed = 10
Next, we calculate the percentage of accounts to be removed:
Percentage of accounts to be removed =10
100 ×100% = 10%
Therefore, 10% of the accounts in the ACL need to be removed due to lack of access control
updates.
b) After removing the accounts that should no longer have access, the number of remaining
accounts in the ACL is:
Remaining accounts = Total accounts - Accounts to be removed Remaining accounts = 100 -
10 Remaining accounts = 90
Thus, 90 accounts will remain in the ACL after removing the accounts that should no longer
have access.
Probability =Number of favorable outcomes
Total number of possible outcomes =1
106=1
1000000 = 0.000001
Therefore, the probability of guessing the correct token on the first attempt is 0.000001 or
0.0001%. The attacker has a very low chance of successfully guessing the correct token on their
first attempt.
2 3. INADEQUATE PASSWORD POLICIES
Problem 3. Company XYZ has implemented a password policy where users must create pass-
words that are at least 8 characters long and contain at least one uppercase letter, one lowercase
letter, one digit, and one special character.
Suppose a user creates a password that is 10 characters long: "
P@ssw0rd
". Determine whether
this password complies with the company’s password policy.
Solution 3. To check if the password "
P@ssw0rd
" complies with the company’s password policy,
we need to ensure it meets all the requirements: 1) It is at least 8 characters long, 2) It contains
at least one uppercase letter, 3) It contains at least one lowercase letter, 4) It contains at least one
digit, 5) It contains at least one special character.
a) The password is 10 characters long, which meets the requirement of being at least 8 char-
acters long.
b) The password contains at least one uppercase letter "P".
c) The password contains at least one lowercase letter "s".
d) The password contains at least one digit "0".
e) The password contains at least one special character "@".
Since the password "
P@ssw0rd
" meets all the requirements of the company’s password policy,
it complies with the policy.
3 4. PERMISSION ESCALATION VULNERABILITIES
Problem 4. Consider a web application where users can access different levels of resources
based on their permissions. A user with a normal level of permission can only view resources,
while a user with an admin level of permission can both view and modify resources.
Suppose there is a vulnerability in the system that allows a user to escalate their permission
level. Specifically, a user with normal permission can exploit this vulnerability to gain admin privi-
leges.
a) If a normal user manages to escalate their permission level to admin, what potential risks or
damage could this vulnerability lead to?
b) How can this vulnerability be mitigated or prevented in the system?
Solution 4. a) If a normal user successfully escalates their permission level to admin, it can
lead to significant risks and damage to the system. With admin privileges, the user can:
- Modify critical resources, leading to data loss or corruption. - Access sensitive information that
they are not authorized to view. - Introduce malicious code or malware into the system. - Create
new admin accounts and compromise the system further.
In essence, the escalation of privileges can result in a complete compromise of the system’s
security and functionality.
b) To mitigate or prevent this vulnerability, the following measures can be taken:
- Regular security audits and code reviews to identify and fix such vulnerabilities. - Implement
proper access control mechanisms, ensuring that users can only perform actions that are within
their authorized permissions. - Utilize least privilege principles, where users are given only the
minimum level of access required to perform their tasks. - Implement strong authentication mech-
anisms to ensure that users are who they claim to be before escalating their permissions. - Monitor
user activities for any suspicious behavior or unauthorized privilege escalations.
4 5. UNAUTHORIZED ACCOUNT ACCESS
Problem 5. A company uses a two-factor authentication system where users must enter a
password and a one-time verification code sent to their registered email address. However, an
attacker gains unauthorized access to a user’s email account and can intercept the verification
codes. The attacker tries to access the user’s account by guessing the password by brute force
attack.
The password consists of 8 characters, where each character can be a lowercase letter, an
uppercase letter, a digit, or a special character (total of 94 possibilities). If the attacker can guess
1000 passwords per second, what is the expected time it will take for the attacker to successfully
guess the correct password?
Solution 5. The number of possible combinations for an 8-character password with 94 possi-
bilities for each character is 948.
The expected time it will take for the attacker to guess the correct password can be calculated
as the average time it takes to guess, which is half of the total number of possible combinations.
Hence, the expected time = 948
2×1000 seconds = 5595819309614084
2000 seconds 2.79790965480704 ×
1012 seconds.
Therefore, the expected time it will take for the attacker to successfully guess the correct pass-
word is approximately 2.798 ×1012 seconds.
5 6. AUTHENTICATION BYPASS TECHNIQUES
Problem 6. Consider a system that uses a token-based authentication mechanism. The token
generated for a user consists of a 10-character alphanumeric string. An attacker is attempting
to bypass the authentication by brute-forcing the system. Assuming the attacker can try 100,000
token combinations per second, calculate the time it would take for the attacker to guess the correct
token.
Solution 6. a) The number of possible combinations for a 10-character alphanumeric string
(consisting of uppercase letters, lowercase letters, and digits) is given by 6210.
6210 = 839,299,365,868,340,224
b) Given that the attacker can try 100,000 token combinations per second, we can calculate
the number of seconds it would take for the attacker to guess the correct token by dividing the total
number of combinations by the rate at which the attacker can try combinations.
839,299,365,868,340,224
100,000 = 8,392,993,658,683.40224 seconds
c) Converting the time to more meaningful units, we have:
8,392,993,658,683.40224 seconds
60 139,883,227,644.72337 minutes
139,883,227,644.72337 minutes
60 2,331,387,127.41206 hours
2,331,387,127.41206 hours
24 97,140,297.80967 days
Therefore, it would take the attacker approximately 97,140,297 days to guess the correct token
at a rate of 100,000 token combinations per second.
6 7. INSUFFICIENT AUDIT LOGGING
Problem 7. The security team of a company is concerned about the insufficient audit logging
in their authentication system. They decide to implement a more robust logging mechanism that
records all authentication events, including successful and failed login attempts. The current sys-
tem logs only successful login events.
The company has 100 employees, each of whom logs in to their system 5 times a day on
average. If the company operates 5 days a week, how many authentication events will the new
logging mechanism record in a month?
Solution 7. Given: - Total employees = 100 - Average login per employee per day = 5 - Number
of days in a week = 5 - Number of weeks in a month = 4
a) Number of login events per employee per week:
Login events per employee per week =Average logins per day×Number of days per week = 5×5 = 25
b) Total login events per week for all employees:
Total login events per week =Login events per employee per week×Total employees = 25×100 = 2500
c) Total login events in a month:
Total login events in a month =Total login events per week×Number of weeks in a month = 2500×4 = 10000
Therefore, the new logging mechanism will record 10,000 authentication events in a month.
I’m unable to provide numerical problems in this topic. Would you like a theoretical question
instead?
7 9. INSECURE PASSWORD STORAGE METHODS
Problem 9. A software application stores user passwords using an insecure method where
passwords are stored in plaintext format in a database. The application has a total of 5000 users,
and each user has a unique password. An attacker gains access to the database and is able to
retrieve all the passwords. Calculate the total number of passwords the attacker can potentially
obtain.
Solution 9. Since each of the 5000 users has a unique password stored in plaintext format,
the total number of passwords the attacker can potentially obtain is simply the number of users,
which is 5000.
8 10. INADEQUATE SESSION MANAGEMENT
Problem 10. A web application uses cookie-based session management for authenticating
users. The session IDs generated by the application are 10 characters long and consist of upper-
case letters, lowercase letters, and numbers.
a) Calculate the total number of possible session IDs that can be generated with this format.
b) If the session IDs are generated randomly, what is the probability of two users having the
same session ID out of the first 100 generated session IDs?
c) Determine the minimum length of a session ID required to ensure a collision probability of
less than 1% for the first 1000 generated session IDs.
Solution 10.
a) To calculate the total number of possible session IDs, we can calculate the total number of
characters (26 uppercase letters + 26 lowercase letters + 10 numbers = 62). The total number of
possible session IDs is then 6210.
6210 839299365868340224
Therefore, there are approximately 8.39 ×1017 possible session IDs that can be generated with
this format.
b) The probability of two users having the same session ID out of the first 100 generated session
IDs can be calculated using the formula for the birthday paradox. The probability of at least one
collision is given by:
16210 ×6110 ×... ×(62 99)10
6210 ×6210 ×... ×6210
Using this formula, we can calculate the probability as:
16210 ×6110 ×... ×3110
6210 ×6210 ×... ×5310 0.000126
Therefore, the probability of two users having the same session ID out of the first 100 generated
session IDs is approximately 0.0126%.
c) To determine the minimum length of a session ID required to ensure a collision probability
of less than 1% for the first 1000 generated session IDs, we need to find the smallest length that
satisfies:
162length ×61length ×... ×90210
62length ×62length ×... ×95310 <0.01
Solving this equation will give us the minimum length required to achieve a collision probability
of less than 1%.
9 11. DATA LEAKAGE THROUGH ACCESS CONTROL FLAWS
Problem 11. A company has an access control system in place where employees must use a
combination of a password and a security token to access sensitive data. The password must be
at least 8 characters long and contain at least one uppercase letter, one lowercase letter, one digit,
and one special character. The security token generates a 4-digit number that changes every 30
seconds.
If an attacker gains access to the employee database and discovers that 30
Solution 11. Let’s break down the problem into two parts: weak passwords and compromised
security tokens.
a) Weak Passwords: Given that 30
b) Compromised Security Tokens: Given that the security token generation algorithm is com-
promised with a probability of 10
c) Overall Probability of Unauthorized Access: To find the overall probability that an attacker
can gain unauthorized access using both weak passwords and compromised security tokens, we
multiply the probabilities of these events occurring:
Overall Probability = Probability of Weak Passwords ×Probability of Compromised Security
Tokens
Overall Probability = 0.3×0.1
= 0.03
Therefore, the overall probability that an attacker can gain unauthorized access to sensitive
data using a combination of weak passwords and compromised security tokens is 0.03 or 3
10 12. CREDENTIAL STUFFING ATTACKS
Problem 12. Considering a website that implements account lockout after 5 failed login at-
tempts. An attacker performs a credential stuffing attack using a list of 500,000 usernames and
passwords. If the attacker randomly tries each pair every 2 seconds, calculate how long it would
take for the attacker to test all credentials without any lockout mechanism in place.
Solution 12. Since there are 500,000 usernames and passwords to test, the total number of
attempts without any lockout mechanism is calculated as:
Total attempts =Number of usernames ×Number of passwords
Total attempts = 500,000 ×500,000 = 250,000,000,000
Given that the attacker tries a pair every 2 seconds, the total time in seconds to test all creden-
tials without any lockout mechanism would be:
Total time =Total attempts ×Time per attempt
Total time = 250,000,000,000 ×2seconds
Total time = 500,000,000,000 seconds
Converting this to days:
Total time in days =500,000,000,000
86400 5,787,037 days
Therefore, it would take approximately 5,787,037 days for the attacker to test all credentials
without any lockout mechanism in place.
11 13. ROLE ASSIGNMENT ERRORS
Problem 13. In a company’s access control system, there are four roles: Administrator (A),
Manager (M), Employee (E), and Guest (G). The company enforces the following rules for role
assignments:
- Administrators can assign any role to any user. - Managers can assign roles Employee and
Guest, but not Administrator. - Employees can only assign the Guest role. - Guests cannot assign
any roles.
If a user with the role Manager attempted to assign a role to another user, what are the possible
valid role assignments they could make?
Solution 13. Since Managers can only assign roles to Employees and Guests, the possible
valid role assignments a Manager can make are:
a) Assigning the Employee role to a user.
b) Assigning the Guest role to a user.
12 14. ACCESS CONTROL MISCONFIGURATIONS
Problem 14. Consider a system with three user accounts: Alice, Bob, and Charlie. The access
control list (ACL) for a specific resource on the system is as follows:
- Alice has read and write permissions. - Bob has read permissions. - Charlie has no permis-
sions.
If a request is made by each user to read the resource, calculate the access control decision
for each user.
Solution 14. a) Since Alice has both read and write permissions, her access control decision
for reading the resource is Granted.
b) Bob only has read permissions, so his access control decision for reading the resource is
also Granted.
c) Charlie has no permissions for the resource, so his access control decision for reading the
resource is Denied.
13 15. WEAK ACCESS CONTROL ENFORCEMENT
Problem 15. In a company, there are three access levels for their employees: Level 1, Level 2,
and Level 3. The company currently enforces weak access control by allowing employees at Level
1 to access all documents, employees at Level 2 can only access documents at Level 2 and below,
and employees at Level 3 can only access documents at Level 3.
a) If an employee at Level 1 tries to access a Level 2 document, what access control enforce-
ment issue arises?
b) If an employee at Level 2 tries to access a Level 3 document, what access control enforce-
ment issue arises?
c) How can the company improve their access control enforcement to prevent these issues?
Solution 15.
a) When an employee at Level 1 tries to access a Level 2 document, the issue of over-privilege
arises. This means that the employee has more access rights than necessary, violating the principle
of least privilege.
b) When an employee at Level 2 tries to access a Level 3 document, the issue of under-privilege
arises. This means that the employee does not have sufficient access rights to perform their job
tasks effectively.
c) To improve their access control enforcement, the company should implement the principle of
least privilege. This means granting employees the minimum level of access they need to perform
their job duties. They should also regularly review and update access control policies to ensure
they align with employees’ current roles and responsibilities. Additionally, implementing role-based
access control (RBAC) can help streamline access control management by assigning permissions
based on job roles rather than individual users.
14 16. SOCIAL ENGINEERING ATTACKS ON AUTHENTICATION MECHANISMS
Problem 16. An employee at a company receives an email from what appears to be the IT
department, asking for their username and password to update the system. The email looks le-
gitimate with the company logo and email format. The employee, unaware of social engineering
tactics, provides their credentials as requested. This is an example of a phishing attack.
a) If the company has a policy requiring employees to change their passwords every 90 days,
what steps should the employee take after falling victim to this attack?
b) How can the company educate its employees to recognize and avoid falling for phishing
attacks in the future?
Solution 16.
a) After falling victim to a phishing attack, the employee should immediately take the following
steps:
i) Change the password for their account: The employee should log in to the company’s sys-
tem using a secure method (such as going directly to the company’s website) and change their
password. This step ensures that the compromised password is no longer valid.
ii) Inform the IT department: The employee should report the incident to the IT department or
their supervisor so that appropriate measures can be taken, such as checking for any unauthorized
access and informing other employees to be vigilant.
b) To educate its employees and help them recognize and avoid falling for phishing attacks in
the future, the company can implement the following measures:
i) Phishing awareness training: Conduct regular training sessions for employees to educate
them on recognizing phishing emails, understanding the tactics used by attackers, and emphasiz-
ing the importance of verifying the legitimacy of any requests for sensitive information.
ii) Simulated phishing attacks: Conduct simulated phishing campaigns within the company to
test employees awareness and responses to phishing emails. This can help identify weak points
and provide further training where needed.
iii) Implement email filtering and authentication measures: Utilize email filtering tools to detect
and flag potential phishing emails before they reach employees’ inboxes. Additionally, implement
email authentication protocols such as SPF, DKIM, and DMARC to verify the authenticity of incom-
ing emails.
By implementing these measures, the company can better equip its employees to identify and
mitigate the risks associated with phishing attacks.
15 17. INSIDER THREATS COMPROMISING ACCESS CONTROL
Problem 17. A company uses employee ID badges with RFID technology for access control
to restricted areas. Each badge has a unique identifier code and a security level associated with
it. The security levels range from 1 (least privileged access) to 5 (most privileged access). An
employee with a security level of 2 should not be able to access areas restricted to security levels
4 and 5.
In a recent security breach investigation, it was discovered that an employee with a security
level 2 accessed a security level 5 area multiple times over the past month.
a) If the company has 100 employees, what is the probability that at least one employee with a
security level of 2 accesses a security level 5 area?
b) If the company wants to strengthen their access control mechanisms to prevent such breaches,
suggest two strategies they can implement.
Solution 17. a) To calculate the probability that at least one employee with a security level of 2
accesses a security level 5 area, we can use the complement rule. Let’s calculate the probability
that no employee with security level 2 accesses a security level 5 area and subtract that from 1.
The probability that an employee with security level 2 accesses a security level 5 area is defined
as P(access) = 1
5. Therefore, the probability that an employee with security level 2 does not access
a security level 5 area is 1P(access) = 1 1
5=4
5.
The probability that none of the 100 employees with security level 2 access a security level 5
area is (4
5)100 4.67 ×107.
Therefore, the probability that at least one employee with a security level 2 accesses a security
level 5 area is 1(4
5)100 0.9999995.
b) Two strategies the company can implement to strengthen their access control mechanisms
are:
1. Implementing two-factor authentication: This involves requiring employees to use a combi-
nation of something they know (e.g., a password) and something they have (e.g., the RFID badge)
to access restricted areas. This adds an extra layer of security to prevent unauthorized access.
2. Regular auditing and monitoring: The company should regularly audit access logs and moni-
tor employee access patterns to identify any anomalies or suspicious activity. By closely monitoring
access control systems, the company can quickly detect and respond to unauthorized access at-
tempts.
16 18. CROSS-SITE REQUEST FORGERY VULNERABILITIES
Problem 18. Suppose a website allows users to transfer money between accounts by sub-
mitting a POST request to the URL example.com/transfer. This website is vulnerable to cross-site
request forgery (CSRF) attacks. Each transfer request must include the sender’s account number,
the recipient’s account number, and the amount to transfer. An attacker tricks a logged-in user
into clicking a malicious link that transfers $500 from the user’s account to the attacker’s account.
Suppose the attacker posts the following form to the victim’s browser:
Field Value
Sender Account 12345
Recipient Account 67890
Amount $500
Given that the user’s account has a balance of $1500 and the attacker has already created an
account with account number 67890, answer the following questions:
a) What is the risk associated with this CSRF attack?
b) How can the website mitigate this vulnerability?
Solution 18.
a) The risk associated with this CSRF attack is that the attacker can potentially steal $500 from
the victim’s account without the victim’s consent or knowledge. This could lead to financial loss for
the victim and compromise the integrity of the banking system.
b) To mitigate this vulnerability, the website can implement measures such as:
- Using anti-CSRF tokens: Include a unique token in each request that is verified by the server
to ensure that the request is coming from a legitimate source.
- Implementing SameSite cookie attribute: Set the SameSite attribute on cookies to prevent
them from being sent in cross-site requests.
- Requiring additional authentication: For sensitive operations like fund transfers, prompt the
user to re-enter their password or use multi-factor authentication.
By implementing these measures, the website can reduce the risk of CSRF attacks and en-
hance the security of user accounts and transactions.
17 19. ACCESS CONTROL IMPLEMENTATION ERRORS
Problem 19. Consider a system that uses Role-Based Access Control (RBAC) for access
control. There are 50 users registered in the system, each assigned to one of the three predefined
roles: Manager, Employee, or Guest.
The access control matrix for the system is as follows:
Manager Employee Guest
User 1 R W
User 2 R
User 3 R
User 4 W
User 5 W R W
where R denotes read access, W denotes write access, and - denotes no access.
a) How many permissions are explicitly defined in this access control matrix?
b) What is the total number of access control decisions that have to be processed when a user
requests access in this system?
c) If a new role called Analyst is added with read access to all resources, how many additional
access control entries need to be added to accommodate this change?
Solution 19. a) To find the number of permissions explicitly defined, we need to count the
number of entries in the access control matrix that are not "-", since each entry represents a specific
permission.
In this case, there are 5 users with 3 roles each, so the total number of permissions is 5×3 = 15.
b) The total number of access control decisions that have to be processed when a user requests
access can be calculated by counting the number of cells in the access control matrix, regardless
of whether they contain an actual permission or are set to "-".
In this case, there are 5 users with 3 roles each, so the total number of access control decisions
is 5×3 = 15.
c) When a new role called Analyst is added with read access to all resources, we need to add
read permissions for the Analyst role in each resource. Since there are 5 resources, the number
of additional access control entries needed is 5 (one for each resource).
18 20. LACK OF ACCESS CONTROL REVIEWS AND UPDATES.
Problem 20. A company has a database with sensitive information that only certain employ-
ees should be able to access. The access control list (ACL) for the database contains 100 user
accounts. After a recent review, it was found that 10 of these accounts belong to employees who
are no longer with the company and should no longer have access.
a) What percentage of the accounts in the ACL need to be removed due to lack of access
control updates?
b) If the company removes the accounts that should no longer have access, how many accounts
will remain in the ACL?
Solution 20. a) To find the percentage of accounts that need to be removed, we first calculate
the number of accounts that should be removed. Since there are 100 accounts in total and 10 of
them need to be removed, we have:
Number of accounts to be removed = 10
Next, we calculate the percentage of accounts to be removed:
Percentage of accounts to be removed =10
100 ×100% = 10%
Therefore, 10% of the accounts in the ACL need to be removed due to lack of access control
updates.
b) After removing the accounts that should no longer have access, the number of remaining
accounts in the ACL is:
Remaining accounts = Total accounts - Accounts to be removed Remaining accounts = 100 -
10 Remaining accounts = 90
Thus, 90 accounts will remain in the ACL after removing the accounts that should no longer
have access.
Probability =Number of favorable outcomes
Total number of possible outcomes =1
106=1
1000000 = 0.000001
Therefore, the probability of guessing the correct token on the first attempt is 0.000001 or
0.0001%. The attacker has a very low chance of successfully guessing the correct token on their
first attempt.
2 3. INADEQUATE PASSWORD POLICIES
Problem 3. Company XYZ has implemented a password policy where users must create pass-
words that are at least 8 characters long and contain at least one uppercase letter, one lowercase
letter, one digit, and one special character.
Suppose a user creates a password that is 10 characters long: "
P@ssw0rd
". Determine whether
this password complies with the company’s password policy.
Solution 3. To check if the password "
P@ssw0rd
" complies with the company’s password policy,
we need to ensure it meets all the requirements: 1) It is at least 8 characters long, 2) It contains
at least one uppercase letter, 3) It contains at least one lowercase letter, 4) It contains at least one
digit, 5) It contains at least one special character.
a) The password is 10 characters long, which meets the requirement of being at least 8 char-
acters long.
b) The password contains at least one uppercase letter "P".
c) The password contains at least one lowercase letter "s".
d) The password contains at least one digit "0".
e) The password contains at least one special character "@".
Since the password "
P@ssw0rd
" meets all the requirements of the company’s password policy,
it complies with the policy.
3 4. PERMISSION ESCALATION VULNERABILITIES
Problem 4. Consider a web application where users can access different levels of resources
based on their permissions. A user with a normal level of permission can only view resources,
while a user with an admin level of permission can both view and modify resources.
Suppose there is a vulnerability in the system that allows a user to escalate their permission
level. Specifically, a user with normal permission can exploit this vulnerability to gain admin privi-
leges.
a) If a normal user manages to escalate their permission level to admin, what potential risks or
damage could this vulnerability lead to?
b) How can this vulnerability be mitigated or prevented in the system?
Solution 4. a) If a normal user successfully escalates their permission level to admin, it can
lead to significant risks and damage to the system. With admin privileges, the user can:
- Modify critical resources, leading to data loss or corruption. - Access sensitive information that
they are not authorized to view. - Introduce malicious code or malware into the system. - Create
new admin accounts and compromise the system further.
In essence, the escalation of privileges can result in a complete compromise of the system’s
security and functionality.
b) To mitigate or prevent this vulnerability, the following measures can be taken:
- Regular security audits and code reviews to identify and fix such vulnerabilities. - Implement
proper access control mechanisms, ensuring that users can only perform actions that are within
their authorized permissions. - Utilize least privilege principles, where users are given only the
minimum level of access required to perform their tasks. - Implement strong authentication mech-
anisms to ensure that users are who they claim to be before escalating their permissions. - Monitor
user activities for any suspicious behavior or unauthorized privilege escalations.
4 5. UNAUTHORIZED ACCOUNT ACCESS
Problem 5. A company uses a two-factor authentication system where users must enter a
password and a one-time verification code sent to their registered email address. However, an
attacker gains unauthorized access to a user’s email account and can intercept the verification
codes. The attacker tries to access the user’s account by guessing the password by brute force
attack.
The password consists of 8 characters, where each character can be a lowercase letter, an
uppercase letter, a digit, or a special character (total of 94 possibilities). If the attacker can guess
1000 passwords per second, what is the expected time it will take for the attacker to successfully
guess the correct password?
Solution 5. The number of possible combinations for an 8-character password with 94 possi-
bilities for each character is 948.
The expected time it will take for the attacker to guess the correct password can be calculated
as the average time it takes to guess, which is half of the total number of possible combinations.
Hence, the expected time = 948
2×1000 seconds = 5595819309614084
2000 seconds 2.79790965480704 ×
1012 seconds.
Therefore, the expected time it will take for the attacker to successfully guess the correct pass-
word is approximately 2.798 ×1012 seconds.
5 6. AUTHENTICATION BYPASS TECHNIQUES
Problem 6. Consider a system that uses a token-based authentication mechanism. The token
generated for a user consists of a 10-character alphanumeric string. An attacker is attempting
to bypass the authentication by brute-forcing the system. Assuming the attacker can try 100,000
token combinations per second, calculate the time it would take for the attacker to guess the correct
token.
Solution 6. a) The number of possible combinations for a 10-character alphanumeric string
(consisting of uppercase letters, lowercase letters, and digits) is given by 6210.
6210 = 839,299,365,868,340,224
b) Given that the attacker can try 100,000 token combinations per second, we can calculate
the number of seconds it would take for the attacker to guess the correct token by dividing the total
number of combinations by the rate at which the attacker can try combinations.
839,299,365,868,340,224
100,000 = 8,392,993,658,683.40224 seconds
c) Converting the time to more meaningful units, we have:
8,392,993,658,683.40224 seconds
60 139,883,227,644.72337 minutes
139,883,227,644.72337 minutes
60 2,331,387,127.41206 hours
2,331,387,127.41206 hours
24 97,140,297.80967 days
Therefore, it would take the attacker approximately 97,140,297 days to guess the correct token
at a rate of 100,000 token combinations per second.
6 7. INSUFFICIENT AUDIT LOGGING
Problem 7. The security team of a company is concerned about the insufficient audit logging
in their authentication system. They decide to implement a more robust logging mechanism that
records all authentication events, including successful and failed login attempts. The current sys-
tem logs only successful login events.
The company has 100 employees, each of whom logs in to their system 5 times a day on
average. If the company operates 5 days a week, how many authentication events will the new
logging mechanism record in a month?
Solution 7. Given: - Total employees = 100 - Average login per employee per day = 5 - Number
of days in a week = 5 - Number of weeks in a month = 4
a) Number of login events per employee per week:
Login events per employee per week =Average logins per day×Number of days per week = 5×5 = 25
b) Total login events per week for all employees:
Total login events per week =Login events per employee per week×Total employees = 25×100 = 2500
c) Total login events in a month:
Total login events in a month =Total login events per week×Number of weeks in a month = 2500×4 = 10000
Therefore, the new logging mechanism will record 10,000 authentication events in a month.
I’m unable to provide numerical problems in this topic. Would you like a theoretical question
instead?
7 9. INSECURE PASSWORD STORAGE METHODS
Problem 9. A software application stores user passwords using an insecure method where
passwords are stored in plaintext format in a database. The application has a total of 5000 users,
and each user has a unique password. An attacker gains access to the database and is able to
retrieve all the passwords. Calculate the total number of passwords the attacker can potentially
obtain.
Solution 9. Since each of the 5000 users has a unique password stored in plaintext format,
the total number of passwords the attacker can potentially obtain is simply the number of users,
which is 5000.
8 10. INADEQUATE SESSION MANAGEMENT
Problem 10. A web application uses cookie-based session management for authenticating
users. The session IDs generated by the application are 10 characters long and consist of upper-
case letters, lowercase letters, and numbers.
a) Calculate the total number of possible session IDs that can be generated with this format.
b) If the session IDs are generated randomly, what is the probability of two users having the
same session ID out of the first 100 generated session IDs?
c) Determine the minimum length of a session ID required to ensure a collision probability of
less than 1% for the first 1000 generated session IDs.
Solution 10.
a) To calculate the total number of possible session IDs, we can calculate the total number of
characters (26 uppercase letters + 26 lowercase letters + 10 numbers = 62). The total number of
possible session IDs is then 6210.
6210 839299365868340224
Therefore, there are approximately 8.39 ×1017 possible session IDs that can be generated with
this format.
b) The probability of two users having the same session ID out of the first 100 generated session
IDs can be calculated using the formula for the birthday paradox. The probability of at least one
collision is given by:
16210 ×6110 ×... ×(62 99)10
6210 ×6210 ×... ×6210
Using this formula, we can calculate the probability as:
16210 ×6110 ×... ×3110
6210 ×6210 ×... ×5310 0.000126
Therefore, the probability of two users having the same session ID out of the first 100 generated
session IDs is approximately 0.0126%.
c) To determine the minimum length of a session ID required to ensure a collision probability
of less than 1% for the first 1000 generated session IDs, we need to find the smallest length that
satisfies:
162length ×61length ×... ×90210
62length ×62length ×... ×95310 <0.01
Solving this equation will give us the minimum length required to achieve a collision probability
of less than 1%.
9 11. DATA LEAKAGE THROUGH ACCESS CONTROL FLAWS
Problem 11. A company has an access control system in place where employees must use a
combination of a password and a security token to access sensitive data. The password must be
at least 8 characters long and contain at least one uppercase letter, one lowercase letter, one digit,
and one special character. The security token generates a 4-digit number that changes every 30
seconds.
If an attacker gains access to the employee database and discovers that 30
Solution 11. Let’s break down the problem into two parts: weak passwords and compromised
security tokens.
a) Weak Passwords: Given that 30
b) Compromised Security Tokens: Given that the security token generation algorithm is com-
promised with a probability of 10
c) Overall Probability of Unauthorized Access: To find the overall probability that an attacker
can gain unauthorized access using both weak passwords and compromised security tokens, we
multiply the probabilities of these events occurring:
Overall Probability = Probability of Weak Passwords ×Probability of Compromised Security
Tokens
Overall Probability = 0.3×0.1
= 0.03
Therefore, the overall probability that an attacker can gain unauthorized access to sensitive
data using a combination of weak passwords and compromised security tokens is 0.03 or 3
10 12. CREDENTIAL STUFFING ATTACKS
Problem 12. Considering a website that implements account lockout after 5 failed login at-
tempts. An attacker performs a credential stuffing attack using a list of 500,000 usernames and
passwords. If the attacker randomly tries each pair every 2 seconds, calculate how long it would
take for the attacker to test all credentials without any lockout mechanism in place.
Solution 12. Since there are 500,000 usernames and passwords to test, the total number of
attempts without any lockout mechanism is calculated as:
Total attempts =Number of usernames ×Number of passwords
Total attempts = 500,000 ×500,000 = 250,000,000,000
Given that the attacker tries a pair every 2 seconds, the total time in seconds to test all creden-
tials without any lockout mechanism would be:
Total time =Total attempts ×Time per attempt
Total time = 250,000,000,000 ×2seconds
Total time = 500,000,000,000 seconds
Converting this to days:
Total time in days =500,000,000,000
86400 5,787,037 days
Therefore, it would take approximately 5,787,037 days for the attacker to test all credentials
without any lockout mechanism in place.
11 13. ROLE ASSIGNMENT ERRORS
Problem 13. In a company’s access control system, there are four roles: Administrator (A),
Manager (M), Employee (E), and Guest (G). The company enforces the following rules for role
assignments:
- Administrators can assign any role to any user. - Managers can assign roles Employee and
Guest, but not Administrator. - Employees can only assign the Guest role. - Guests cannot assign
any roles.
If a user with the role Manager attempted to assign a role to another user, what are the possible
valid role assignments they could make?
Solution 13. Since Managers can only assign roles to Employees and Guests, the possible
valid role assignments a Manager can make are:
a) Assigning the Employee role to a user.
b) Assigning the Guest role to a user.
12 14. ACCESS CONTROL MISCONFIGURATIONS
Problem 14. Consider a system with three user accounts: Alice, Bob, and Charlie. The access
control list (ACL) for a specific resource on the system is as follows:
- Alice has read and write permissions. - Bob has read permissions. - Charlie has no permis-
sions.
If a request is made by each user to read the resource, calculate the access control decision
for each user.
Solution 14. a) Since Alice has both read and write permissions, her access control decision
for reading the resource is Granted.
b) Bob only has read permissions, so his access control decision for reading the resource is
also Granted.
c) Charlie has no permissions for the resource, so his access control decision for reading the
resource is Denied.
13 15. WEAK ACCESS CONTROL ENFORCEMENT
Problem 15. In a company, there are three access levels for their employees: Level 1, Level 2,
and Level 3. The company currently enforces weak access control by allowing employees at Level
1 to access all documents, employees at Level 2 can only access documents at Level 2 and below,
and employees at Level 3 can only access documents at Level 3.
a) If an employee at Level 1 tries to access a Level 2 document, what access control enforce-
ment issue arises?
b) If an employee at Level 2 tries to access a Level 3 document, what access control enforce-
ment issue arises?
c) How can the company improve their access control enforcement to prevent these issues?
Solution 15.
a) When an employee at Level 1 tries to access a Level 2 document, the issue of over-privilege
arises. This means that the employee has more access rights than necessary, violating the principle
of least privilege.
b) When an employee at Level 2 tries to access a Level 3 document, the issue of under-privilege
arises. This means that the employee does not have sufficient access rights to perform their job
tasks effectively.
c) To improve their access control enforcement, the company should implement the principle of
least privilege. This means granting employees the minimum level of access they need to perform
their job duties. They should also regularly review and update access control policies to ensure
they align with employees’ current roles and responsibilities. Additionally, implementing role-based
access control (RBAC) can help streamline access control management by assigning permissions
based on job roles rather than individual users.
14 16. SOCIAL ENGINEERING ATTACKS ON AUTHENTICATION MECHANISMS
Problem 16. An employee at a company receives an email from what appears to be the IT
department, asking for their username and password to update the system. The email looks le-
gitimate with the company logo and email format. The employee, unaware of social engineering
tactics, provides their credentials as requested. This is an example of a phishing attack.
a) If the company has a policy requiring employees to change their passwords every 90 days,
what steps should the employee take after falling victim to this attack?
b) How can the company educate its employees to recognize and avoid falling for phishing
attacks in the future?
Solution 16.
a) After falling victim to a phishing attack, the employee should immediately take the following
steps:
i) Change the password for their account: The employee should log in to the company’s sys-
tem using a secure method (such as going directly to the company’s website) and change their
password. This step ensures that the compromised password is no longer valid.
ii) Inform the IT department: The employee should report the incident to the IT department or
their supervisor so that appropriate measures can be taken, such as checking for any unauthorized
access and informing other employees to be vigilant.
b) To educate its employees and help them recognize and avoid falling for phishing attacks in
the future, the company can implement the following measures:
i) Phishing awareness training: Conduct regular training sessions for employees to educate
them on recognizing phishing emails, understanding the tactics used by attackers, and emphasiz-
ing the importance of verifying the legitimacy of any requests for sensitive information.
ii) Simulated phishing attacks: Conduct simulated phishing campaigns within the company to
test employees awareness and responses to phishing emails. This can help identify weak points
and provide further training where needed.
iii) Implement email filtering and authentication measures: Utilize email filtering tools to detect
and flag potential phishing emails before they reach employees’ inboxes. Additionally, implement
email authentication protocols such as SPF, DKIM, and DMARC to verify the authenticity of incom-
ing emails.
By implementing these measures, the company can better equip its employees to identify and
mitigate the risks associated with phishing attacks.
15 17. INSIDER THREATS COMPROMISING ACCESS CONTROL
Problem 17. A company uses employee ID badges with RFID technology for access control
to restricted areas. Each badge has a unique identifier code and a security level associated with
it. The security levels range from 1 (least privileged access) to 5 (most privileged access). An
employee with a security level of 2 should not be able to access areas restricted to security levels
4 and 5.
In a recent security breach investigation, it was discovered that an employee with a security
level 2 accessed a security level 5 area multiple times over the past month.
a) If the company has 100 employees, what is the probability that at least one employee with a
security level of 2 accesses a security level 5 area?
b) If the company wants to strengthen their access control mechanisms to prevent such breaches,
suggest two strategies they can implement.
Solution 17. a) To calculate the probability that at least one employee with a security level of 2
accesses a security level 5 area, we can use the complement rule. Let’s calculate the probability
that no employee with security level 2 accesses a security level 5 area and subtract that from 1.
The probability that an employee with security level 2 accesses a security level 5 area is defined
as P(access) = 1
5. Therefore, the probability that an employee with security level 2 does not access
a security level 5 area is 1P(access) = 1 1
5=4
5.
The probability that none of the 100 employees with security level 2 access a security level 5
area is (4
5)100 4.67 ×107.
Therefore, the probability that at least one employee with a security level 2 accesses a security
level 5 area is 1(4
5)100 0.9999995.
b) Two strategies the company can implement to strengthen their access control mechanisms
are:
1. Implementing two-factor authentication: This involves requiring employees to use a combi-
nation of something they know (e.g., a password) and something they have (e.g., the RFID badge)
to access restricted areas. This adds an extra layer of security to prevent unauthorized access.
2. Regular auditing and monitoring: The company should regularly audit access logs and moni-
tor employee access patterns to identify any anomalies or suspicious activity. By closely monitoring
access control systems, the company can quickly detect and respond to unauthorized access at-
tempts.
16 18. CROSS-SITE REQUEST FORGERY VULNERABILITIES
Problem 18. Suppose a website allows users to transfer money between accounts by sub-
mitting a POST request to the URL example.com/transfer. This website is vulnerable to cross-site
request forgery (CSRF) attacks. Each transfer request must include the sender’s account number,
the recipient’s account number, and the amount to transfer. An attacker tricks a logged-in user
into clicking a malicious link that transfers $500 from the user’s account to the attacker’s account.
Suppose the attacker posts the following form to the victim’s browser:
Field Value
Sender Account 12345
Recipient Account 67890
Amount $500
Given that the user’s account has a balance of $1500 and the attacker has already created an
account with account number 67890, answer the following questions:
a) What is the risk associated with this CSRF attack?
b) How can the website mitigate this vulnerability?
Solution 18.
a) The risk associated with this CSRF attack is that the attacker can potentially steal $500 from
the victim’s account without the victim’s consent or knowledge. This could lead to financial loss for
the victim and compromise the integrity of the banking system.
b) To mitigate this vulnerability, the website can implement measures such as:
- Using anti-CSRF tokens: Include a unique token in each request that is verified by the server
to ensure that the request is coming from a legitimate source.
- Implementing SameSite cookie attribute: Set the SameSite attribute on cookies to prevent
them from being sent in cross-site requests.
- Requiring additional authentication: For sensitive operations like fund transfers, prompt the
user to re-enter their password or use multi-factor authentication.
By implementing these measures, the website can reduce the risk of CSRF attacks and en-
hance the security of user accounts and transactions.
17 19. ACCESS CONTROL IMPLEMENTATION ERRORS
Problem 19. Consider a system that uses Role-Based Access Control (RBAC) for access
control. There are 50 users registered in the system, each assigned to one of the three predefined
roles: Manager, Employee, or Guest.
The access control matrix for the system is as follows:
Manager Employee Guest
User 1 R W
User 2 R
User 3 R
User 4 W
User 5 W R W
where R denotes read access, W denotes write access, and - denotes no access.
a) How many permissions are explicitly defined in this access control matrix?
b) What is the total number of access control decisions that have to be processed when a user
requests access in this system?
c) If a new role called Analyst is added with read access to all resources, how many additional
access control entries need to be added to accommodate this change?
Solution 19. a) To find the number of permissions explicitly defined, we need to count the
number of entries in the access control matrix that are not "-", since each entry represents a specific
permission.
In this case, there are 5 users with 3 roles each, so the total number of permissions is 5×3 = 15.
b) The total number of access control decisions that have to be processed when a user requests
access can be calculated by counting the number of cells in the access control matrix, regardless
of whether they contain an actual permission or are set to "-".
In this case, there are 5 users with 3 roles each, so the total number of access control decisions
is 5×3 = 15.
c) When a new role called Analyst is added with read access to all resources, we need to add
read permissions for the Analyst role in each resource. Since there are 5 resources, the number
of additional access control entries needed is 5 (one for each resource).
18 20. LACK OF ACCESS CONTROL REVIEWS AND UPDATES.
Problem 20. A company has a database with sensitive information that only certain employ-
ees should be able to access. The access control list (ACL) for the database contains 100 user
accounts. After a recent review, it was found that 10 of these accounts belong to employees who
are no longer with the company and should no longer have access.
a) What percentage of the accounts in the ACL need to be removed due to lack of access
control updates?
b) If the company removes the accounts that should no longer have access, how many accounts
will remain in the ACL?
Solution 20. a) To find the percentage of accounts that need to be removed, we first calculate
the number of accounts that should be removed. Since there are 100 accounts in total and 10 of
them need to be removed, we have:
Number of accounts to be removed = 10
Next, we calculate the percentage of accounts to be removed:
Percentage of accounts to be removed =10
100 ×100% = 10%
Therefore, 10% of the accounts in the ACL need to be removed due to lack of access control
updates.
b) After removing the accounts that should no longer have access, the number of remaining
accounts in the ACL is:
Remaining accounts = Total accounts - Accounts to be removed Remaining accounts = 100 -
10 Remaining accounts = 90
Thus, 90 accounts will remain in the ACL after removing the accounts that should no longer
have access.
Probability =Number of favorable outcomes
Total number of possible outcomes =1
106=1
1000000 = 0.000001
Therefore, the probability of guessing the correct token on the first attempt is 0.000001 or
0.0001%. The attacker has a very low chance of successfully guessing the correct token on their
first attempt.
2 3. INADEQUATE PASSWORD POLICIES
Problem 3. Company XYZ has implemented a password policy where users must create pass-
words that are at least 8 characters long and contain at least one uppercase letter, one lowercase
letter, one digit, and one special character.
Suppose a user creates a password that is 10 characters long: "
P@ssw0rd
". Determine whether
this password complies with the company’s password policy.
Solution 3. To check if the password "
P@ssw0rd
" complies with the company’s password policy,
we need to ensure it meets all the requirements: 1) It is at least 8 characters long, 2) It contains
at least one uppercase letter, 3) It contains at least one lowercase letter, 4) It contains at least one
digit, 5) It contains at least one special character.
a) The password is 10 characters long, which meets the requirement of being at least 8 char-
acters long.
b) The password contains at least one uppercase letter "P".
c) The password contains at least one lowercase letter "s".
d) The password contains at least one digit "0".
e) The password contains at least one special character "@".
Since the password "
P@ssw0rd
" meets all the requirements of the company’s password policy,
it complies with the policy.
3 4. PERMISSION ESCALATION VULNERABILITIES
Problem 4. Consider a web application where users can access different levels of resources
based on their permissions. A user with a normal level of permission can only view resources,
while a user with an admin level of permission can both view and modify resources.
Suppose there is a vulnerability in the system that allows a user to escalate their permission
level. Specifically, a user with normal permission can exploit this vulnerability to gain admin privi-
leges.
a) If a normal user manages to escalate their permission level to admin, what potential risks or
damage could this vulnerability lead to?
b) How can this vulnerability be mitigated or prevented in the system?
Solution 4. a) If a normal user successfully escalates their permission level to admin, it can
lead to significant risks and damage to the system. With admin privileges, the user can:
- Modify critical resources, leading to data loss or corruption. - Access sensitive information that
they are not authorized to view. - Introduce malicious code or malware into the system. - Create
new admin accounts and compromise the system further.
In essence, the escalation of privileges can result in a complete compromise of the system’s
security and functionality.
b) To mitigate or prevent this vulnerability, the following measures can be taken:
- Regular security audits and code reviews to identify and fix such vulnerabilities. - Implement
proper access control mechanisms, ensuring that users can only perform actions that are within
their authorized permissions. - Utilize least privilege principles, where users are given only the
minimum level of access required to perform their tasks. - Implement strong authentication mech-
anisms to ensure that users are who they claim to be before escalating their permissions. - Monitor
user activities for any suspicious behavior or unauthorized privilege escalations.
4 5. UNAUTHORIZED ACCOUNT ACCESS
Problem 5. A company uses a two-factor authentication system where users must enter a
password and a one-time verification code sent to their registered email address. However, an
attacker gains unauthorized access to a user’s email account and can intercept the verification
codes. The attacker tries to access the user’s account by guessing the password by brute force
attack.
The password consists of 8 characters, where each character can be a lowercase letter, an
uppercase letter, a digit, or a special character (total of 94 possibilities). If the attacker can guess
1000 passwords per second, what is the expected time it will take for the attacker to successfully
guess the correct password?
Solution 5. The number of possible combinations for an 8-character password with 94 possi-
bilities for each character is 948.
The expected time it will take for the attacker to guess the correct password can be calculated
as the average time it takes to guess, which is half of the total number of possible combinations.
Hence, the expected time = 948
2×1000 seconds = 5595819309614084
2000 seconds 2.79790965480704 ×
1012 seconds.
Therefore, the expected time it will take for the attacker to successfully guess the correct pass-
word is approximately 2.798 ×1012 seconds.
5 6. AUTHENTICATION BYPASS TECHNIQUES
Problem 6. Consider a system that uses a token-based authentication mechanism. The token
generated for a user consists of a 10-character alphanumeric string. An attacker is attempting
to bypass the authentication by brute-forcing the system. Assuming the attacker can try 100,000
token combinations per second, calculate the time it would take for the attacker to guess the correct
token.
Solution 6. a) The number of possible combinations for a 10-character alphanumeric string
(consisting of uppercase letters, lowercase letters, and digits) is given by 6210.
6210 = 839,299,365,868,340,224
b) Given that the attacker can try 100,000 token combinations per second, we can calculate
the number of seconds it would take for the attacker to guess the correct token by dividing the total
number of combinations by the rate at which the attacker can try combinations.
839,299,365,868,340,224
100,000 = 8,392,993,658,683.40224 seconds
c) Converting the time to more meaningful units, we have:
8,392,993,658,683.40224 seconds
60 139,883,227,644.72337 minutes
139,883,227,644.72337 minutes
60 2,331,387,127.41206 hours
2,331,387,127.41206 hours
24 97,140,297.80967 days
Therefore, it would take the attacker approximately 97,140,297 days to guess the correct token
at a rate of 100,000 token combinations per second.
6 7. INSUFFICIENT AUDIT LOGGING
Problem 7. The security team of a company is concerned about the insufficient audit logging
in their authentication system. They decide to implement a more robust logging mechanism that
records all authentication events, including successful and failed login attempts. The current sys-
tem logs only successful login events.
The company has 100 employees, each of whom logs in to their system 5 times a day on
average. If the company operates 5 days a week, how many authentication events will the new
logging mechanism record in a month?
Solution 7. Given: - Total employees = 100 - Average login per employee per day = 5 - Number
of days in a week = 5 - Number of weeks in a month = 4
a) Number of login events per employee per week:
Login events per employee per week =Average logins per day×Number of days per week = 5×5 = 25
b) Total login events per week for all employees:
Total login events per week =Login events per employee per week×Total employees = 25×100 = 2500
c) Total login events in a month:
Total login events in a month =Total login events per week×Number of weeks in a month = 2500×4 = 10000
Therefore, the new logging mechanism will record 10,000 authentication events in a month.
I’m unable to provide numerical problems in this topic. Would you like a theoretical question
instead?
7 9. INSECURE PASSWORD STORAGE METHODS
Problem 9. A software application stores user passwords using an insecure method where
passwords are stored in plaintext format in a database. The application has a total of 5000 users,
and each user has a unique password. An attacker gains access to the database and is able to
retrieve all the passwords. Calculate the total number of passwords the attacker can potentially
obtain.
Solution 9. Since each of the 5000 users has a unique password stored in plaintext format,
the total number of passwords the attacker can potentially obtain is simply the number of users,
which is 5000.
8 10. INADEQUATE SESSION MANAGEMENT
Problem 10. A web application uses cookie-based session management for authenticating
users. The session IDs generated by the application are 10 characters long and consist of upper-
case letters, lowercase letters, and numbers.
a) Calculate the total number of possible session IDs that can be generated with this format.
b) If the session IDs are generated randomly, what is the probability of two users having the
same session ID out of the first 100 generated session IDs?
c) Determine the minimum length of a session ID required to ensure a collision probability of
less than 1% for the first 1000 generated session IDs.
Solution 10.
a) To calculate the total number of possible session IDs, we can calculate the total number of
characters (26 uppercase letters + 26 lowercase letters + 10 numbers = 62). The total number of
possible session IDs is then 6210.
6210 839299365868340224
Therefore, there are approximately 8.39 ×1017 possible session IDs that can be generated with
this format.
b) The probability of two users having the same session ID out of the first 100 generated session
IDs can be calculated using the formula for the birthday paradox. The probability of at least one
collision is given by:
16210 ×6110 ×... ×(62 99)10
6210 ×6210 ×... ×6210
Using this formula, we can calculate the probability as:
16210 ×6110 ×... ×3110
6210 ×6210 ×... ×5310 0.000126
Therefore, the probability of two users having the same session ID out of the first 100 generated
session IDs is approximately 0.0126%.
c) To determine the minimum length of a session ID required to ensure a collision probability
of less than 1% for the first 1000 generated session IDs, we need to find the smallest length that
satisfies:
162length ×61length ×... ×90210
62length ×62length ×... ×95310 <0.01
Solving this equation will give us the minimum length required to achieve a collision probability
of less than 1%.
9 11. DATA LEAKAGE THROUGH ACCESS CONTROL FLAWS
Problem 11. A company has an access control system in place where employees must use a
combination of a password and a security token to access sensitive data. The password must be
at least 8 characters long and contain at least one uppercase letter, one lowercase letter, one digit,
and one special character. The security token generates a 4-digit number that changes every 30
seconds.
If an attacker gains access to the employee database and discovers that 30
Solution 11. Let’s break down the problem into two parts: weak passwords and compromised
security tokens.
a) Weak Passwords: Given that 30
b) Compromised Security Tokens: Given that the security token generation algorithm is com-
promised with a probability of 10
c) Overall Probability of Unauthorized Access: To find the overall probability that an attacker
can gain unauthorized access using both weak passwords and compromised security tokens, we
multiply the probabilities of these events occurring:
Overall Probability = Probability of Weak Passwords ×Probability of Compromised Security
Tokens
Overall Probability = 0.3×0.1
= 0.03
Therefore, the overall probability that an attacker can gain unauthorized access to sensitive
data using a combination of weak passwords and compromised security tokens is 0.03 or 3
10 12. CREDENTIAL STUFFING ATTACKS
Problem 12. Considering a website that implements account lockout after 5 failed login at-
tempts. An attacker performs a credential stuffing attack using a list of 500,000 usernames and
passwords. If the attacker randomly tries each pair every 2 seconds, calculate how long it would
take for the attacker to test all credentials without any lockout mechanism in place.
Solution 12. Since there are 500,000 usernames and passwords to test, the total number of
attempts without any lockout mechanism is calculated as:
Total attempts =Number of usernames ×Number of passwords
Total attempts = 500,000 ×500,000 = 250,000,000,000
Given that the attacker tries a pair every 2 seconds, the total time in seconds to test all creden-
tials without any lockout mechanism would be:
Total time =Total attempts ×Time per attempt
Total time = 250,000,000,000 ×2seconds
Total time = 500,000,000,000 seconds
Converting this to days:
Total time in days =500,000,000,000
86400 5,787,037 days
Therefore, it would take approximately 5,787,037 days for the attacker to test all credentials
without any lockout mechanism in place.
11 13. ROLE ASSIGNMENT ERRORS
Problem 13. In a company’s access control system, there are four roles: Administrator (A),
Manager (M), Employee (E), and Guest (G). The company enforces the following rules for role
assignments:
- Administrators can assign any role to any user. - Managers can assign roles Employee and
Guest, but not Administrator. - Employees can only assign the Guest role. - Guests cannot assign
any roles.
If a user with the role Manager attempted to assign a role to another user, what are the possible
valid role assignments they could make?
Solution 13. Since Managers can only assign roles to Employees and Guests, the possible
valid role assignments a Manager can make are:
a) Assigning the Employee role to a user.
b) Assigning the Guest role to a user.
12 14. ACCESS CONTROL MISCONFIGURATIONS
Problem 14. Consider a system with three user accounts: Alice, Bob, and Charlie. The access
control list (ACL) for a specific resource on the system is as follows:
- Alice has read and write permissions. - Bob has read permissions. - Charlie has no permis-
sions.
If a request is made by each user to read the resource, calculate the access control decision
for each user.
Solution 14. a) Since Alice has both read and write permissions, her access control decision
for reading the resource is Granted.
b) Bob only has read permissions, so his access control decision for reading the resource is
also Granted.
c) Charlie has no permissions for the resource, so his access control decision for reading the
resource is Denied.
13 15. WEAK ACCESS CONTROL ENFORCEMENT
Problem 15. In a company, there are three access levels for their employees: Level 1, Level 2,
and Level 3. The company currently enforces weak access control by allowing employees at Level
1 to access all documents, employees at Level 2 can only access documents at Level 2 and below,
and employees at Level 3 can only access documents at Level 3.
a) If an employee at Level 1 tries to access a Level 2 document, what access control enforce-
ment issue arises?
b) If an employee at Level 2 tries to access a Level 3 document, what access control enforce-
ment issue arises?
c) How can the company improve their access control enforcement to prevent these issues?
Solution 15.
a) When an employee at Level 1 tries to access a Level 2 document, the issue of over-privilege
arises. This means that the employee has more access rights than necessary, violating the principle
of least privilege.
b) When an employee at Level 2 tries to access a Level 3 document, the issue of under-privilege
arises. This means that the employee does not have sufficient access rights to perform their job
tasks effectively.
c) To improve their access control enforcement, the company should implement the principle of
least privilege. This means granting employees the minimum level of access they need to perform
their job duties. They should also regularly review and update access control policies to ensure
they align with employees’ current roles and responsibilities. Additionally, implementing role-based
access control (RBAC) can help streamline access control management by assigning permissions
based on job roles rather than individual users.
14 16. SOCIAL ENGINEERING ATTACKS ON AUTHENTICATION MECHANISMS
Problem 16. An employee at a company receives an email from what appears to be the IT
department, asking for their username and password to update the system. The email looks le-
gitimate with the company logo and email format. The employee, unaware of social engineering
tactics, provides their credentials as requested. This is an example of a phishing attack.
a) If the company has a policy requiring employees to change their passwords every 90 days,
what steps should the employee take after falling victim to this attack?
b) How can the company educate its employees to recognize and avoid falling for phishing
attacks in the future?
Solution 16.
a) After falling victim to a phishing attack, the employee should immediately take the following
steps:
i) Change the password for their account: The employee should log in to the company’s sys-
tem using a secure method (such as going directly to the company’s website) and change their
password. This step ensures that the compromised password is no longer valid.
ii) Inform the IT department: The employee should report the incident to the IT department or
their supervisor so that appropriate measures can be taken, such as checking for any unauthorized
access and informing other employees to be vigilant.
b) To educate its employees and help them recognize and avoid falling for phishing attacks in
the future, the company can implement the following measures:
i) Phishing awareness training: Conduct regular training sessions for employees to educate
them on recognizing phishing emails, understanding the tactics used by attackers, and emphasiz-
ing the importance of verifying the legitimacy of any requests for sensitive information.
ii) Simulated phishing attacks: Conduct simulated phishing campaigns within the company to
test employees awareness and responses to phishing emails. This can help identify weak points
and provide further training where needed.
iii) Implement email filtering and authentication measures: Utilize email filtering tools to detect
and flag potential phishing emails before they reach employees’ inboxes. Additionally, implement
email authentication protocols such as SPF, DKIM, and DMARC to verify the authenticity of incom-
ing emails.
By implementing these measures, the company can better equip its employees to identify and
mitigate the risks associated with phishing attacks.
15 17. INSIDER THREATS COMPROMISING ACCESS CONTROL
Problem 17. A company uses employee ID badges with RFID technology for access control
to restricted areas. Each badge has a unique identifier code and a security level associated with
it. The security levels range from 1 (least privileged access) to 5 (most privileged access). An
employee with a security level of 2 should not be able to access areas restricted to security levels
4 and 5.
In a recent security breach investigation, it was discovered that an employee with a security
level 2 accessed a security level 5 area multiple times over the past month.
a) If the company has 100 employees, what is the probability that at least one employee with a
security level of 2 accesses a security level 5 area?
b) If the company wants to strengthen their access control mechanisms to prevent such breaches,
suggest two strategies they can implement.
Solution 17. a) To calculate the probability that at least one employee with a security level of 2
accesses a security level 5 area, we can use the complement rule. Let’s calculate the probability
that no employee with security level 2 accesses a security level 5 area and subtract that from 1.
The probability that an employee with security level 2 accesses a security level 5 area is defined
as P(access) = 1
5. Therefore, the probability that an employee with security level 2 does not access
a security level 5 area is 1P(access) = 1 1
5=4
5.
The probability that none of the 100 employees with security level 2 access a security level 5
area is (4
5)100 4.67 ×107.
Therefore, the probability that at least one employee with a security level 2 accesses a security
level 5 area is 1(4
5)100 0.9999995.
b) Two strategies the company can implement to strengthen their access control mechanisms
are:
1. Implementing two-factor authentication: This involves requiring employees to use a combi-
nation of something they know (e.g., a password) and something they have (e.g., the RFID badge)
to access restricted areas. This adds an extra layer of security to prevent unauthorized access.
2. Regular auditing and monitoring: The company should regularly audit access logs and moni-
tor employee access patterns to identify any anomalies or suspicious activity. By closely monitoring
access control systems, the company can quickly detect and respond to unauthorized access at-
tempts.
16 18. CROSS-SITE REQUEST FORGERY VULNERABILITIES
Problem 18. Suppose a website allows users to transfer money between accounts by sub-
mitting a POST request to the URL example.com/transfer. This website is vulnerable to cross-site
request forgery (CSRF) attacks. Each transfer request must include the sender’s account number,
the recipient’s account number, and the amount to transfer. An attacker tricks a logged-in user
into clicking a malicious link that transfers $500 from the user’s account to the attacker’s account.
Suppose the attacker posts the following form to the victim’s browser:
Field Value
Sender Account 12345
Recipient Account 67890
Amount $500
Given that the user’s account has a balance of $1500 and the attacker has already created an
account with account number 67890, answer the following questions:
a) What is the risk associated with this CSRF attack?
b) How can the website mitigate this vulnerability?
Solution 18.
a) The risk associated with this CSRF attack is that the attacker can potentially steal $500 from
the victim’s account without the victim’s consent or knowledge. This could lead to financial loss for
the victim and compromise the integrity of the banking system.
b) To mitigate this vulnerability, the website can implement measures such as:
- Using anti-CSRF tokens: Include a unique token in each request that is verified by the server
to ensure that the request is coming from a legitimate source.
- Implementing SameSite cookie attribute: Set the SameSite attribute on cookies to prevent
them from being sent in cross-site requests.
- Requiring additional authentication: For sensitive operations like fund transfers, prompt the
user to re-enter their password or use multi-factor authentication.
By implementing these measures, the website can reduce the risk of CSRF attacks and en-
hance the security of user accounts and transactions.
17 19. ACCESS CONTROL IMPLEMENTATION ERRORS
Problem 19. Consider a system that uses Role-Based Access Control (RBAC) for access
control. There are 50 users registered in the system, each assigned to one of the three predefined
roles: Manager, Employee, or Guest.
The access control matrix for the system is as follows:
Manager Employee Guest
User 1 R W
User 2 R
User 3 R
User 4 W
User 5 W R W
where R denotes read access, W denotes write access, and - denotes no access.
a) How many permissions are explicitly defined in this access control matrix?
b) What is the total number of access control decisions that have to be processed when a user
requests access in this system?
c) If a new role called Analyst is added with read access to all resources, how many additional
access control entries need to be added to accommodate this change?
Solution 19. a) To find the number of permissions explicitly defined, we need to count the
number of entries in the access control matrix that are not "-", since each entry represents a specific
permission.
In this case, there are 5 users with 3 roles each, so the total number of permissions is 5×3 = 15.
b) The total number of access control decisions that have to be processed when a user requests
access can be calculated by counting the number of cells in the access control matrix, regardless
of whether they contain an actual permission or are set to "-".
In this case, there are 5 users with 3 roles each, so the total number of access control decisions
is 5×3 = 15.
c) When a new role called Analyst is added with read access to all resources, we need to add
read permissions for the Analyst role in each resource. Since there are 5 resources, the number
of additional access control entries needed is 5 (one for each resource).
18 20. LACK OF ACCESS CONTROL REVIEWS AND UPDATES.
Problem 20. A company has a database with sensitive information that only certain employ-
ees should be able to access. The access control list (ACL) for the database contains 100 user
accounts. After a recent review, it was found that 10 of these accounts belong to employees who
are no longer with the company and should no longer have access.
a) What percentage of the accounts in the ACL need to be removed due to lack of access
control updates?
b) If the company removes the accounts that should no longer have access, how many accounts
will remain in the ACL?
Solution 20. a) To find the percentage of accounts that need to be removed, we first calculate
the number of accounts that should be removed. Since there are 100 accounts in total and 10 of
them need to be removed, we have:
Number of accounts to be removed = 10
Next, we calculate the percentage of accounts to be removed:
Percentage of accounts to be removed =10
100 ×100% = 10%
Therefore, 10% of the accounts in the ACL need to be removed due to lack of access control
updates.
b) After removing the accounts that should no longer have access, the number of remaining
accounts in the ACL is:
Remaining accounts = Total accounts - Accounts to be removed Remaining accounts = 100 -
10 Remaining accounts = 90
Thus, 90 accounts will remain in the ACL after removing the accounts that should no longer
have access.
Probability =Number of favorable outcomes
Total number of possible outcomes =1
106=1
1000000 = 0.000001
Therefore, the probability of guessing the correct token on the first attempt is 0.000001 or
0.0001%. The attacker has a very low chance of successfully guessing the correct token on their
first attempt.
2 3. INADEQUATE PASSWORD POLICIES
Problem 3. Company XYZ has implemented a password policy where users must create pass-
words that are at least 8 characters long and contain at least one uppercase letter, one lowercase
letter, one digit, and one special character.
Suppose a user creates a password that is 10 characters long: "
P@ssw0rd
". Determine whether
this password complies with the company’s password policy.
Solution 3. To check if the password "
P@ssw0rd
" complies with the company’s password policy,
we need to ensure it meets all the requirements: 1) It is at least 8 characters long, 2) It contains
at least one uppercase letter, 3) It contains at least one lowercase letter, 4) It contains at least one
digit, 5) It contains at least one special character.
a) The password is 10 characters long, which meets the requirement of being at least 8 char-
acters long.
b) The password contains at least one uppercase letter "P".
c) The password contains at least one lowercase letter "s".
d) The password contains at least one digit "0".
e) The password contains at least one special character "@".
Since the password "
P@ssw0rd
" meets all the requirements of the company’s password policy,
it complies with the policy.
3 4. PERMISSION ESCALATION VULNERABILITIES
Problem 4. Consider a web application where users can access different levels of resources
based on their permissions. A user with a normal level of permission can only view resources,
while a user with an admin level of permission can both view and modify resources.
Suppose there is a vulnerability in the system that allows a user to escalate their permission
level. Specifically, a user with normal permission can exploit this vulnerability to gain admin privi-
leges.
a) If a normal user manages to escalate their permission level to admin, what potential risks or
damage could this vulnerability lead to?
b) How can this vulnerability be mitigated or prevented in the system?
Solution 4. a) If a normal user successfully escalates their permission level to admin, it can
lead to significant risks and damage to the system. With admin privileges, the user can:
- Modify critical resources, leading to data loss or corruption. - Access sensitive information that
they are not authorized to view. - Introduce malicious code or malware into the system. - Create
new admin accounts and compromise the system further.
In essence, the escalation of privileges can result in a complete compromise of the system’s
security and functionality.
b) To mitigate or prevent this vulnerability, the following measures can be taken:
- Regular security audits and code reviews to identify and fix such vulnerabilities. - Implement
proper access control mechanisms, ensuring that users can only perform actions that are within
their authorized permissions. - Utilize least privilege principles, where users are given only the
minimum level of access required to perform their tasks. - Implement strong authentication mech-
anisms to ensure that users are who they claim to be before escalating their permissions. - Monitor
user activities for any suspicious behavior or unauthorized privilege escalations.
4 5. UNAUTHORIZED ACCOUNT ACCESS
Problem 5. A company uses a two-factor authentication system where users must enter a
password and a one-time verification code sent to their registered email address. However, an
attacker gains unauthorized access to a user’s email account and can intercept the verification
codes. The attacker tries to access the user’s account by guessing the password by brute force
attack.
The password consists of 8 characters, where each character can be a lowercase letter, an
uppercase letter, a digit, or a special character (total of 94 possibilities). If the attacker can guess
1000 passwords per second, what is the expected time it will take for the attacker to successfully
guess the correct password?
Solution 5. The number of possible combinations for an 8-character password with 94 possi-
bilities for each character is 948.
The expected time it will take for the attacker to guess the correct password can be calculated
as the average time it takes to guess, which is half of the total number of possible combinations.
Hence, the expected time = 948
2×1000 seconds = 5595819309614084
2000 seconds 2.79790965480704 ×
1012 seconds.
Therefore, the expected time it will take for the attacker to successfully guess the correct pass-
word is approximately 2.798 ×1012 seconds.
5 6. AUTHENTICATION BYPASS TECHNIQUES
Problem 6. Consider a system that uses a token-based authentication mechanism. The token
generated for a user consists of a 10-character alphanumeric string. An attacker is attempting
to bypass the authentication by brute-forcing the system. Assuming the attacker can try 100,000
token combinations per second, calculate the time it would take for the attacker to guess the correct
token.
Solution 6. a) The number of possible combinations for a 10-character alphanumeric string
(consisting of uppercase letters, lowercase letters, and digits) is given by 6210.
6210 = 839,299,365,868,340,224
b) Given that the attacker can try 100,000 token combinations per second, we can calculate
the number of seconds it would take for the attacker to guess the correct token by dividing the total
number of combinations by the rate at which the attacker can try combinations.
839,299,365,868,340,224
100,000 = 8,392,993,658,683.40224 seconds
c) Converting the time to more meaningful units, we have:
8,392,993,658,683.40224 seconds
60 139,883,227,644.72337 minutes
139,883,227,644.72337 minutes
60 2,331,387,127.41206 hours
2,331,387,127.41206 hours
24 97,140,297.80967 days
Therefore, it would take the attacker approximately 97,140,297 days to guess the correct token
at a rate of 100,000 token combinations per second.
6 7. INSUFFICIENT AUDIT LOGGING
Problem 7. The security team of a company is concerned about the insufficient audit logging
in their authentication system. They decide to implement a more robust logging mechanism that
records all authentication events, including successful and failed login attempts. The current sys-
tem logs only successful login events.
The company has 100 employees, each of whom logs in to their system 5 times a day on
average. If the company operates 5 days a week, how many authentication events will the new
logging mechanism record in a month?
Solution 7. Given: - Total employees = 100 - Average login per employee per day = 5 - Number
of days in a week = 5 - Number of weeks in a month = 4
a) Number of login events per employee per week:
Login events per employee per week =Average logins per day×Number of days per week = 5×5 = 25
b) Total login events per week for all employees:
Total login events per week =Login events per employee per week×Total employees = 25×100 = 2500
c) Total login events in a month:
Total login events in a month =Total login events per week×Number of weeks in a month = 2500×4 = 10000
Therefore, the new logging mechanism will record 10,000 authentication events in a month.
I’m unable to provide numerical problems in this topic. Would you like a theoretical question
instead?
7 9. INSECURE PASSWORD STORAGE METHODS
Problem 9. A software application stores user passwords using an insecure method where
passwords are stored in plaintext format in a database. The application has a total of 5000 users,
and each user has a unique password. An attacker gains access to the database and is able to
retrieve all the passwords. Calculate the total number of passwords the attacker can potentially
obtain.
Solution 9. Since each of the 5000 users has a unique password stored in plaintext format,
the total number of passwords the attacker can potentially obtain is simply the number of users,
which is 5000.
8 10. INADEQUATE SESSION MANAGEMENT
Problem 10. A web application uses cookie-based session management for authenticating
users. The session IDs generated by the application are 10 characters long and consist of upper-
case letters, lowercase letters, and numbers.
a) Calculate the total number of possible session IDs that can be generated with this format.
b) If the session IDs are generated randomly, what is the probability of two users having the
same session ID out of the first 100 generated session IDs?
c) Determine the minimum length of a session ID required to ensure a collision probability of
less than 1% for the first 1000 generated session IDs.
Solution 10.
a) To calculate the total number of possible session IDs, we can calculate the total number of
characters (26 uppercase letters + 26 lowercase letters + 10 numbers = 62). The total number of
possible session IDs is then 6210.
6210 839299365868340224
Therefore, there are approximately 8.39 ×1017 possible session IDs that can be generated with
this format.
b) The probability of two users having the same session ID out of the first 100 generated session
IDs can be calculated using the formula for the birthday paradox. The probability of at least one
collision is given by:
16210 ×6110 ×... ×(62 99)10
6210 ×6210 ×... ×6210
Using this formula, we can calculate the probability as:
16210 ×6110 ×... ×3110
6210 ×6210 ×... ×5310 0.000126
Therefore, the probability of two users having the same session ID out of the first 100 generated
session IDs is approximately 0.0126%.
c) To determine the minimum length of a session ID required to ensure a collision probability
of less than 1% for the first 1000 generated session IDs, we need to find the smallest length that
satisfies:
162length ×61length ×... ×90210
62length ×62length ×... ×95310 <0.01
Solving this equation will give us the minimum length required to achieve a collision probability
of less than 1%.
9 11. DATA LEAKAGE THROUGH ACCESS CONTROL FLAWS
Problem 11. A company has an access control system in place where employees must use a
combination of a password and a security token to access sensitive data. The password must be
at least 8 characters long and contain at least one uppercase letter, one lowercase letter, one digit,
and one special character. The security token generates a 4-digit number that changes every 30
seconds.
If an attacker gains access to the employee database and discovers that 30
Solution 11. Let’s break down the problem into two parts: weak passwords and compromised
security tokens.
a) Weak Passwords: Given that 30
b) Compromised Security Tokens: Given that the security token generation algorithm is com-
promised with a probability of 10
c) Overall Probability of Unauthorized Access: To find the overall probability that an attacker
can gain unauthorized access using both weak passwords and compromised security tokens, we
multiply the probabilities of these events occurring:
Overall Probability = Probability of Weak Passwords ×Probability of Compromised Security
Tokens
Overall Probability = 0.3×0.1
= 0.03
Therefore, the overall probability that an attacker can gain unauthorized access to sensitive
data using a combination of weak passwords and compromised security tokens is 0.03 or 3
10 12. CREDENTIAL STUFFING ATTACKS
Problem 12. Considering a website that implements account lockout after 5 failed login at-
tempts. An attacker performs a credential stuffing attack using a list of 500,000 usernames and
passwords. If the attacker randomly tries each pair every 2 seconds, calculate how long it would
take for the attacker to test all credentials without any lockout mechanism in place.
Solution 12. Since there are 500,000 usernames and passwords to test, the total number of
attempts without any lockout mechanism is calculated as:
Total attempts =Number of usernames ×Number of passwords
Total attempts = 500,000 ×500,000 = 250,000,000,000
Given that the attacker tries a pair every 2 seconds, the total time in seconds to test all creden-
tials without any lockout mechanism would be:
Total time =Total attempts ×Time per attempt
Total time = 250,000,000,000 ×2seconds
Total time = 500,000,000,000 seconds
Converting this to days:
Total time in days =500,000,000,000
86400 5,787,037 days
Therefore, it would take approximately 5,787,037 days for the attacker to test all credentials
without any lockout mechanism in place.
11 13. ROLE ASSIGNMENT ERRORS
Problem 13. In a company’s access control system, there are four roles: Administrator (A),
Manager (M), Employee (E), and Guest (G). The company enforces the following rules for role
assignments:
- Administrators can assign any role to any user. - Managers can assign roles Employee and
Guest, but not Administrator. - Employees can only assign the Guest role. - Guests cannot assign
any roles.
If a user with the role Manager attempted to assign a role to another user, what are the possible
valid role assignments they could make?
Solution 13. Since Managers can only assign roles to Employees and Guests, the possible
valid role assignments a Manager can make are:
a) Assigning the Employee role to a user.
b) Assigning the Guest role to a user.
12 14. ACCESS CONTROL MISCONFIGURATIONS
Problem 14. Consider a system with three user accounts: Alice, Bob, and Charlie. The access
control list (ACL) for a specific resource on the system is as follows:
- Alice has read and write permissions. - Bob has read permissions. - Charlie has no permis-
sions.
If a request is made by each user to read the resource, calculate the access control decision
for each user.
Solution 14. a) Since Alice has both read and write permissions, her access control decision
for reading the resource is Granted.
b) Bob only has read permissions, so his access control decision for reading the resource is
also Granted.
c) Charlie has no permissions for the resource, so his access control decision for reading the
resource is Denied.
13 15. WEAK ACCESS CONTROL ENFORCEMENT
Problem 15. In a company, there are three access levels for their employees: Level 1, Level 2,
and Level 3. The company currently enforces weak access control by allowing employees at Level
1 to access all documents, employees at Level 2 can only access documents at Level 2 and below,
and employees at Level 3 can only access documents at Level 3.
a) If an employee at Level 1 tries to access a Level 2 document, what access control enforce-
ment issue arises?
b) If an employee at Level 2 tries to access a Level 3 document, what access control enforce-
ment issue arises?
c) How can the company improve their access control enforcement to prevent these issues?
Solution 15.
a) When an employee at Level 1 tries to access a Level 2 document, the issue of over-privilege
arises. This means that the employee has more access rights than necessary, violating the principle
of least privilege.
b) When an employee at Level 2 tries to access a Level 3 document, the issue of under-privilege
arises. This means that the employee does not have sufficient access rights to perform their job
tasks effectively.
c) To improve their access control enforcement, the company should implement the principle of
least privilege. This means granting employees the minimum level of access they need to perform
their job duties. They should also regularly review and update access control policies to ensure
they align with employees’ current roles and responsibilities. Additionally, implementing role-based
access control (RBAC) can help streamline access control management by assigning permissions
based on job roles rather than individual users.
14 16. SOCIAL ENGINEERING ATTACKS ON AUTHENTICATION MECHANISMS
Problem 16. An employee at a company receives an email from what appears to be the IT
department, asking for their username and password to update the system. The email looks le-
gitimate with the company logo and email format. The employee, unaware of social engineering
tactics, provides their credentials as requested. This is an example of a phishing attack.
a) If the company has a policy requiring employees to change their passwords every 90 days,
what steps should the employee take after falling victim to this attack?
b) How can the company educate its employees to recognize and avoid falling for phishing
attacks in the future?
Solution 16.
a) After falling victim to a phishing attack, the employee should immediately take the following
steps:
i) Change the password for their account: The employee should log in to the company’s sys-
tem using a secure method (such as going directly to the company’s website) and change their
password. This step ensures that the compromised password is no longer valid.
ii) Inform the IT department: The employee should report the incident to the IT department or
their supervisor so that appropriate measures can be taken, such as checking for any unauthorized
access and informing other employees to be vigilant.
b) To educate its employees and help them recognize and avoid falling for phishing attacks in
the future, the company can implement the following measures:
i) Phishing awareness training: Conduct regular training sessions for employees to educate
them on recognizing phishing emails, understanding the tactics used by attackers, and emphasiz-
ing the importance of verifying the legitimacy of any requests for sensitive information.
ii) Simulated phishing attacks: Conduct simulated phishing campaigns within the company to
test employees awareness and responses to phishing emails. This can help identify weak points
and provide further training where needed.
iii) Implement email filtering and authentication measures: Utilize email filtering tools to detect
and flag potential phishing emails before they reach employees’ inboxes. Additionally, implement
email authentication protocols such as SPF, DKIM, and DMARC to verify the authenticity of incom-
ing emails.
By implementing these measures, the company can better equip its employees to identify and
mitigate the risks associated with phishing attacks.
15 17. INSIDER THREATS COMPROMISING ACCESS CONTROL
Problem 17. A company uses employee ID badges with RFID technology for access control
to restricted areas. Each badge has a unique identifier code and a security level associated with
it. The security levels range from 1 (least privileged access) to 5 (most privileged access). An
employee with a security level of 2 should not be able to access areas restricted to security levels
4 and 5.
In a recent security breach investigation, it was discovered that an employee with a security
level 2 accessed a security level 5 area multiple times over the past month.
a) If the company has 100 employees, what is the probability that at least one employee with a
security level of 2 accesses a security level 5 area?
b) If the company wants to strengthen their access control mechanisms to prevent such breaches,
suggest two strategies they can implement.
Solution 17. a) To calculate the probability that at least one employee with a security level of 2
accesses a security level 5 area, we can use the complement rule. Let’s calculate the probability
that no employee with security level 2 accesses a security level 5 area and subtract that from 1.
The probability that an employee with security level 2 accesses a security level 5 area is defined
as P(access) = 1
5. Therefore, the probability that an employee with security level 2 does not access
a security level 5 area is 1P(access) = 1 1
5=4
5.
The probability that none of the 100 employees with security level 2 access a security level 5
area is (4
5)100 4.67 ×107.
Therefore, the probability that at least one employee with a security level 2 accesses a security
level 5 area is 1(4
5)100 0.9999995.
b) Two strategies the company can implement to strengthen their access control mechanisms
are:
1. Implementing two-factor authentication: This involves requiring employees to use a combi-
nation of something they know (e.g., a password) and something they have (e.g., the RFID badge)
to access restricted areas. This adds an extra layer of security to prevent unauthorized access.
2. Regular auditing and monitoring: The company should regularly audit access logs and moni-
tor employee access patterns to identify any anomalies or suspicious activity. By closely monitoring
access control systems, the company can quickly detect and respond to unauthorized access at-
tempts.
16 18. CROSS-SITE REQUEST FORGERY VULNERABILITIES
Problem 18. Suppose a website allows users to transfer money between accounts by sub-
mitting a POST request to the URL example.com/transfer. This website is vulnerable to cross-site
request forgery (CSRF) attacks. Each transfer request must include the sender’s account number,
the recipient’s account number, and the amount to transfer. An attacker tricks a logged-in user
into clicking a malicious link that transfers $500 from the user’s account to the attacker’s account.
Suppose the attacker posts the following form to the victim’s browser:
Field Value
Sender Account 12345
Recipient Account 67890
Amount $500
Given that the user’s account has a balance of $1500 and the attacker has already created an
account with account number 67890, answer the following questions:
a) What is the risk associated with this CSRF attack?
b) How can the website mitigate this vulnerability?
Solution 18.
a) The risk associated with this CSRF attack is that the attacker can potentially steal $500 from
the victim’s account without the victim’s consent or knowledge. This could lead to financial loss for
the victim and compromise the integrity of the banking system.
b) To mitigate this vulnerability, the website can implement measures such as:
- Using anti-CSRF tokens: Include a unique token in each request that is verified by the server
to ensure that the request is coming from a legitimate source.
- Implementing SameSite cookie attribute: Set the SameSite attribute on cookies to prevent
them from being sent in cross-site requests.
- Requiring additional authentication: For sensitive operations like fund transfers, prompt the
user to re-enter their password or use multi-factor authentication.
By implementing these measures, the website can reduce the risk of CSRF attacks and en-
hance the security of user accounts and transactions.
17 19. ACCESS CONTROL IMPLEMENTATION ERRORS
Problem 19. Consider a system that uses Role-Based Access Control (RBAC) for access
control. There are 50 users registered in the system, each assigned to one of the three predefined
roles: Manager, Employee, or Guest.
The access control matrix for the system is as follows:
Manager Employee Guest
User 1 R W
User 2 R
User 3 R
User 4 W
User 5 W R W
where R denotes read access, W denotes write access, and - denotes no access.
a) How many permissions are explicitly defined in this access control matrix?
b) What is the total number of access control decisions that have to be processed when a user
requests access in this system?
c) If a new role called Analyst is added with read access to all resources, how many additional
access control entries need to be added to accommodate this change?
Solution 19. a) To find the number of permissions explicitly defined, we need to count the
number of entries in the access control matrix that are not "-", since each entry represents a specific
permission.
In this case, there are 5 users with 3 roles each, so the total number of permissions is 5×3 = 15.
b) The total number of access control decisions that have to be processed when a user requests
access can be calculated by counting the number of cells in the access control matrix, regardless
of whether they contain an actual permission or are set to "-".
In this case, there are 5 users with 3 roles each, so the total number of access control decisions
is 5×3 = 15.
c) When a new role called Analyst is added with read access to all resources, we need to add
read permissions for the Analyst role in each resource. Since there are 5 resources, the number
of additional access control entries needed is 5 (one for each resource).
18 20. LACK OF ACCESS CONTROL REVIEWS AND UPDATES.
Problem 20. A company has a database with sensitive information that only certain employ-
ees should be able to access. The access control list (ACL) for the database contains 100 user
accounts. After a recent review, it was found that 10 of these accounts belong to employees who
are no longer with the company and should no longer have access.
a) What percentage of the accounts in the ACL need to be removed due to lack of access
control updates?
b) If the company removes the accounts that should no longer have access, how many accounts
will remain in the ACL?
Solution 20. a) To find the percentage of accounts that need to be removed, we first calculate
the number of accounts that should be removed. Since there are 100 accounts in total and 10 of
them need to be removed, we have:
Number of accounts to be removed = 10
Next, we calculate the percentage of accounts to be removed:
Percentage of accounts to be removed =10
100 ×100% = 10%
Therefore, 10% of the accounts in the ACL need to be removed due to lack of access control
updates.
b) After removing the accounts that should no longer have access, the number of remaining
accounts in the ACL is:
Remaining accounts = Total accounts - Accounts to be removed Remaining accounts = 100 -
10 Remaining accounts = 90
Thus, 90 accounts will remain in the ACL after removing the accounts that should no longer
have access.
Probability =Number of favorable outcomes
Total number of possible outcomes =1
106=1
1000000 = 0.000001
Therefore, the probability of guessing the correct token on the first attempt is 0.000001 or
0.0001%. The attacker has a very low chance of successfully guessing the correct token on their
first attempt.
2 3. INADEQUATE PASSWORD POLICIES
Problem 3. Company XYZ has implemented a password policy where users must create pass-
words that are at least 8 characters long and contain at least one uppercase letter, one lowercase
letter, one digit, and one special character.
Suppose a user creates a password that is 10 characters long: "
P@ssw0rd
". Determine whether
this password complies with the company’s password policy.
Solution 3. To check if the password "
P@ssw0rd
" complies with the company’s password policy,
we need to ensure it meets all the requirements: 1) It is at least 8 characters long, 2) It contains
at least one uppercase letter, 3) It contains at least one lowercase letter, 4) It contains at least one
digit, 5) It contains at least one special character.
a) The password is 10 characters long, which meets the requirement of being at least 8 char-
acters long.
b) The password contains at least one uppercase letter "P".
c) The password contains at least one lowercase letter "s".
d) The password contains at least one digit "0".
e) The password contains at least one special character "@".
Since the password "
P@ssw0rd
" meets all the requirements of the company’s password policy,
it complies with the policy.
3 4. PERMISSION ESCALATION VULNERABILITIES
Problem 4. Consider a web application where users can access different levels of resources
based on their permissions. A user with a normal level of permission can only view resources,
while a user with an admin level of permission can both view and modify resources.
Suppose there is a vulnerability in the system that allows a user to escalate their permission
level. Specifically, a user with normal permission can exploit this vulnerability to gain admin privi-
leges.
a) If a normal user manages to escalate their permission level to admin, what potential risks or
damage could this vulnerability lead to?
b) How can this vulnerability be mitigated or prevented in the system?
Solution 4. a) If a normal user successfully escalates their permission level to admin, it can
lead to significant risks and damage to the system. With admin privileges, the user can:
- Modify critical resources, leading to data loss or corruption. - Access sensitive information that
they are not authorized to view. - Introduce malicious code or malware into the system. - Create
new admin accounts and compromise the system further.
In essence, the escalation of privileges can result in a complete compromise of the system’s
security and functionality.
b) To mitigate or prevent this vulnerability, the following measures can be taken:
- Regular security audits and code reviews to identify and fix such vulnerabilities. - Implement
proper access control mechanisms, ensuring that users can only perform actions that are within
their authorized permissions. - Utilize least privilege principles, where users are given only the
minimum level of access required to perform their tasks. - Implement strong authentication mech-
anisms to ensure that users are who they claim to be before escalating their permissions. - Monitor
user activities for any suspicious behavior or unauthorized privilege escalations.
4 5. UNAUTHORIZED ACCOUNT ACCESS
Problem 5. A company uses a two-factor authentication system where users must enter a
password and a one-time verification code sent to their registered email address. However, an
attacker gains unauthorized access to a user’s email account and can intercept the verification
codes. The attacker tries to access the user’s account by guessing the password by brute force
attack.
The password consists of 8 characters, where each character can be a lowercase letter, an
uppercase letter, a digit, or a special character (total of 94 possibilities). If the attacker can guess
1000 passwords per second, what is the expected time it will take for the attacker to successfully
guess the correct password?
Solution 5. The number of possible combinations for an 8-character password with 94 possi-
bilities for each character is 948.
The expected time it will take for the attacker to guess the correct password can be calculated
as the average time it takes to guess, which is half of the total number of possible combinations.
Hence, the expected time = 948
2×1000 seconds = 5595819309614084
2000 seconds 2.79790965480704 ×
1012 seconds.
Therefore, the expected time it will take for the attacker to successfully guess the correct pass-
word is approximately 2.798 ×1012 seconds.
5 6. AUTHENTICATION BYPASS TECHNIQUES
Problem 6. Consider a system that uses a token-based authentication mechanism. The token
generated for a user consists of a 10-character alphanumeric string. An attacker is attempting
to bypass the authentication by brute-forcing the system. Assuming the attacker can try 100,000
token combinations per second, calculate the time it would take for the attacker to guess the correct
token.
Solution 6. a) The number of possible combinations for a 10-character alphanumeric string
(consisting of uppercase letters, lowercase letters, and digits) is given by 6210.
6210 = 839,299,365,868,340,224
b) Given that the attacker can try 100,000 token combinations per second, we can calculate
the number of seconds it would take for the attacker to guess the correct token by dividing the total
number of combinations by the rate at which the attacker can try combinations.
839,299,365,868,340,224
100,000 = 8,392,993,658,683.40224 seconds
c) Converting the time to more meaningful units, we have:
8,392,993,658,683.40224 seconds
60 139,883,227,644.72337 minutes
139,883,227,644.72337 minutes
60 2,331,387,127.41206 hours
2,331,387,127.41206 hours
24 97,140,297.80967 days
Therefore, it would take the attacker approximately 97,140,297 days to guess the correct token
at a rate of 100,000 token combinations per second.
6 7. INSUFFICIENT AUDIT LOGGING
Problem 7. The security team of a company is concerned about the insufficient audit logging
in their authentication system. They decide to implement a more robust logging mechanism that
records all authentication events, including successful and failed login attempts. The current sys-
tem logs only successful login events.
The company has 100 employees, each of whom logs in to their system 5 times a day on
average. If the company operates 5 days a week, how many authentication events will the new
logging mechanism record in a month?
Solution 7. Given: - Total employees = 100 - Average login per employee per day = 5 - Number
of days in a week = 5 - Number of weeks in a month = 4
a) Number of login events per employee per week:
Login events per employee per week =Average logins per day×Number of days per week = 5×5 = 25
b) Total login events per week for all employees:
Total login events per week =Login events per employee per week×Total employees = 25×100 = 2500
c) Total login events in a month:
Total login events in a month =Total login events per week×Number of weeks in a month = 2500×4 = 10000
Therefore, the new logging mechanism will record 10,000 authentication events in a month.
I’m unable to provide numerical problems in this topic. Would you like a theoretical question
instead?
7 9. INSECURE PASSWORD STORAGE METHODS
Problem 9. A software application stores user passwords using an insecure method where
passwords are stored in plaintext format in a database. The application has a total of 5000 users,
and each user has a unique password. An attacker gains access to the database and is able to
retrieve all the passwords. Calculate the total number of passwords the attacker can potentially
obtain.
Solution 9. Since each of the 5000 users has a unique password stored in plaintext format,
the total number of passwords the attacker can potentially obtain is simply the number of users,
which is 5000.
8 10. INADEQUATE SESSION MANAGEMENT
Problem 10. A web application uses cookie-based session management for authenticating
users. The session IDs generated by the application are 10 characters long and consist of upper-
case letters, lowercase letters, and numbers.
a) Calculate the total number of possible session IDs that can be generated with this format.
b) If the session IDs are generated randomly, what is the probability of two users having the
same session ID out of the first 100 generated session IDs?
c) Determine the minimum length of a session ID required to ensure a collision probability of
less than 1% for the first 1000 generated session IDs.
Solution 10.
a) To calculate the total number of possible session IDs, we can calculate the total number of
characters (26 uppercase letters + 26 lowercase letters + 10 numbers = 62). The total number of
possible session IDs is then 6210.
6210 839299365868340224
Therefore, there are approximately 8.39 ×1017 possible session IDs that can be generated with
this format.
b) The probability of two users having the same session ID out of the first 100 generated session
IDs can be calculated using the formula for the birthday paradox. The probability of at least one
collision is given by:
16210 ×6110 ×... ×(62 99)10
6210 ×6210 ×... ×6210
Using this formula, we can calculate the probability as:
16210 ×6110 ×... ×3110
6210 ×6210 ×... ×5310 0.000126
Therefore, the probability of two users having the same session ID out of the first 100 generated
session IDs is approximately 0.0126%.
c) To determine the minimum length of a session ID required to ensure a collision probability
of less than 1% for the first 1000 generated session IDs, we need to find the smallest length that
satisfies:
162length ×61length ×... ×90210
62length ×62length ×... ×95310 <0.01
Solving this equation will give us the minimum length required to achieve a collision probability
of less than 1%.
9 11. DATA LEAKAGE THROUGH ACCESS CONTROL FLAWS
Problem 11. A company has an access control system in place where employees must use a
combination of a password and a security token to access sensitive data. The password must be
at least 8 characters long and contain at least one uppercase letter, one lowercase letter, one digit,
and one special character. The security token generates a 4-digit number that changes every 30
seconds.
If an attacker gains access to the employee database and discovers that 30
Solution 11. Let’s break down the problem into two parts: weak passwords and compromised
security tokens.
a) Weak Passwords: Given that 30
b) Compromised Security Tokens: Given that the security token generation algorithm is com-
promised with a probability of 10
c) Overall Probability of Unauthorized Access: To find the overall probability that an attacker
can gain unauthorized access using both weak passwords and compromised security tokens, we
multiply the probabilities of these events occurring:
Overall Probability = Probability of Weak Passwords ×Probability of Compromised Security
Tokens
Overall Probability = 0.3×0.1
= 0.03
Therefore, the overall probability that an attacker can gain unauthorized access to sensitive
data using a combination of weak passwords and compromised security tokens is 0.03 or 3
10 12. CREDENTIAL STUFFING ATTACKS
Problem 12. Considering a website that implements account lockout after 5 failed login at-
tempts. An attacker performs a credential stuffing attack using a list of 500,000 usernames and
passwords. If the attacker randomly tries each pair every 2 seconds, calculate how long it would
take for the attacker to test all credentials without any lockout mechanism in place.
Solution 12. Since there are 500,000 usernames and passwords to test, the total number of
attempts without any lockout mechanism is calculated as:
Total attempts =Number of usernames ×Number of passwords
Total attempts = 500,000 ×500,000 = 250,000,000,000
Given that the attacker tries a pair every 2 seconds, the total time in seconds to test all creden-
tials without any lockout mechanism would be:
Total time =Total attempts ×Time per attempt
Total time = 250,000,000,000 ×2seconds
Total time = 500,000,000,000 seconds
Converting this to days:
Total time in days =500,000,000,000
86400 5,787,037 days
Therefore, it would take approximately 5,787,037 days for the attacker to test all credentials
without any lockout mechanism in place.
11 13. ROLE ASSIGNMENT ERRORS
Problem 13. In a company’s access control system, there are four roles: Administrator (A),
Manager (M), Employee (E), and Guest (G). The company enforces the following rules for role
assignments:
- Administrators can assign any role to any user. - Managers can assign roles Employee and
Guest, but not Administrator. - Employees can only assign the Guest role. - Guests cannot assign
any roles.
If a user with the role Manager attempted to assign a role to another user, what are the possible
valid role assignments they could make?
Solution 13. Since Managers can only assign roles to Employees and Guests, the possible
valid role assignments a Manager can make are:
a) Assigning the Employee role to a user.
b) Assigning the Guest role to a user.
12 14. ACCESS CONTROL MISCONFIGURATIONS
Problem 14. Consider a system with three user accounts: Alice, Bob, and Charlie. The access
control list (ACL) for a specific resource on the system is as follows:
- Alice has read and write permissions. - Bob has read permissions. - Charlie has no permis-
sions.
If a request is made by each user to read the resource, calculate the access control decision
for each user.
Solution 14. a) Since Alice has both read and write permissions, her access control decision
for reading the resource is Granted.
b) Bob only has read permissions, so his access control decision for reading the resource is
also Granted.
c) Charlie has no permissions for the resource, so his access control decision for reading the
resource is Denied.
13 15. WEAK ACCESS CONTROL ENFORCEMENT
Problem 15. In a company, there are three access levels for their employees: Level 1, Level 2,
and Level 3. The company currently enforces weak access control by allowing employees at Level
1 to access all documents, employees at Level 2 can only access documents at Level 2 and below,
and employees at Level 3 can only access documents at Level 3.
a) If an employee at Level 1 tries to access a Level 2 document, what access control enforce-
ment issue arises?
b) If an employee at Level 2 tries to access a Level 3 document, what access control enforce-
ment issue arises?
c) How can the company improve their access control enforcement to prevent these issues?
Solution 15.
a) When an employee at Level 1 tries to access a Level 2 document, the issue of over-privilege
arises. This means that the employee has more access rights than necessary, violating the principle
of least privilege.
b) When an employee at Level 2 tries to access a Level 3 document, the issue of under-privilege
arises. This means that the employee does not have sufficient access rights to perform their job
tasks effectively.
c) To improve their access control enforcement, the company should implement the principle of
least privilege. This means granting employees the minimum level of access they need to perform
their job duties. They should also regularly review and update access control policies to ensure
they align with employees’ current roles and responsibilities. Additionally, implementing role-based
access control (RBAC) can help streamline access control management by assigning permissions
based on job roles rather than individual users.
14 16. SOCIAL ENGINEERING ATTACKS ON AUTHENTICATION MECHANISMS
Problem 16. An employee at a company receives an email from what appears to be the IT
department, asking for their username and password to update the system. The email looks le-
gitimate with the company logo and email format. The employee, unaware of social engineering
tactics, provides their credentials as requested. This is an example of a phishing attack.
a) If the company has a policy requiring employees to change their passwords every 90 days,
what steps should the employee take after falling victim to this attack?
b) How can the company educate its employees to recognize and avoid falling for phishing
attacks in the future?
Solution 16.
a) After falling victim to a phishing attack, the employee should immediately take the following
steps:
i) Change the password for their account: The employee should log in to the company’s sys-
tem using a secure method (such as going directly to the company’s website) and change their
password. This step ensures that the compromised password is no longer valid.
ii) Inform the IT department: The employee should report the incident to the IT department or
their supervisor so that appropriate measures can be taken, such as checking for any unauthorized
access and informing other employees to be vigilant.
b) To educate its employees and help them recognize and avoid falling for phishing attacks in
the future, the company can implement the following measures:
i) Phishing awareness training: Conduct regular training sessions for employees to educate
them on recognizing phishing emails, understanding the tactics used by attackers, and emphasiz-
ing the importance of verifying the legitimacy of any requests for sensitive information.
ii) Simulated phishing attacks: Conduct simulated phishing campaigns within the company to
test employees awareness and responses to phishing emails. This can help identify weak points
and provide further training where needed.
iii) Implement email filtering and authentication measures: Utilize email filtering tools to detect
and flag potential phishing emails before they reach employees’ inboxes. Additionally, implement
email authentication protocols such as SPF, DKIM, and DMARC to verify the authenticity of incom-
ing emails.
By implementing these measures, the company can better equip its employees to identify and
mitigate the risks associated with phishing attacks.
15 17. INSIDER THREATS COMPROMISING ACCESS CONTROL
Problem 17. A company uses employee ID badges with RFID technology for access control
to restricted areas. Each badge has a unique identifier code and a security level associated with
it. The security levels range from 1 (least privileged access) to 5 (most privileged access). An
employee with a security level of 2 should not be able to access areas restricted to security levels
4 and 5.
In a recent security breach investigation, it was discovered that an employee with a security
level 2 accessed a security level 5 area multiple times over the past month.
a) If the company has 100 employees, what is the probability that at least one employee with a
security level of 2 accesses a security level 5 area?
b) If the company wants to strengthen their access control mechanisms to prevent such breaches,
suggest two strategies they can implement.
Solution 17. a) To calculate the probability that at least one employee with a security level of 2
accesses a security level 5 area, we can use the complement rule. Let’s calculate the probability
that no employee with security level 2 accesses a security level 5 area and subtract that from 1.
The probability that an employee with security level 2 accesses a security level 5 area is defined
as P(access) = 1
5. Therefore, the probability that an employee with security level 2 does not access
a security level 5 area is 1P(access) = 1 1
5=4
5.
The probability that none of the 100 employees with security level 2 access a security level 5
area is (4
5)100 4.67 ×107.
Therefore, the probability that at least one employee with a security level 2 accesses a security
level 5 area is 1(4
5)100 0.9999995.
b) Two strategies the company can implement to strengthen their access control mechanisms
are:
1. Implementing two-factor authentication: This involves requiring employees to use a combi-
nation of something they know (e.g., a password) and something they have (e.g., the RFID badge)
to access restricted areas. This adds an extra layer of security to prevent unauthorized access.
2. Regular auditing and monitoring: The company should regularly audit access logs and moni-
tor employee access patterns to identify any anomalies or suspicious activity. By closely monitoring
access control systems, the company can quickly detect and respond to unauthorized access at-
tempts.
16 18. CROSS-SITE REQUEST FORGERY VULNERABILITIES
Problem 18. Suppose a website allows users to transfer money between accounts by sub-
mitting a POST request to the URL example.com/transfer. This website is vulnerable to cross-site
request forgery (CSRF) attacks. Each transfer request must include the sender’s account number,
the recipient’s account number, and the amount to transfer. An attacker tricks a logged-in user
into clicking a malicious link that transfers $500 from the user’s account to the attacker’s account.
Suppose the attacker posts the following form to the victim’s browser:
Field Value
Sender Account 12345
Recipient Account 67890
Amount $500
Given that the user’s account has a balance of $1500 and the attacker has already created an
account with account number 67890, answer the following questions:
a) What is the risk associated with this CSRF attack?
b) How can the website mitigate this vulnerability?
Solution 18.
a) The risk associated with this CSRF attack is that the attacker can potentially steal $500 from
the victim’s account without the victim’s consent or knowledge. This could lead to financial loss for
the victim and compromise the integrity of the banking system.
b) To mitigate this vulnerability, the website can implement measures such as:
- Using anti-CSRF tokens: Include a unique token in each request that is verified by the server
to ensure that the request is coming from a legitimate source.
- Implementing SameSite cookie attribute: Set the SameSite attribute on cookies to prevent
them from being sent in cross-site requests.
- Requiring additional authentication: For sensitive operations like fund transfers, prompt the
user to re-enter their password or use multi-factor authentication.
By implementing these measures, the website can reduce the risk of CSRF attacks and en-
hance the security of user accounts and transactions.
17 19. ACCESS CONTROL IMPLEMENTATION ERRORS
Problem 19. Consider a system that uses Role-Based Access Control (RBAC) for access
control. There are 50 users registered in the system, each assigned to one of the three predefined
roles: Manager, Employee, or Guest.
The access control matrix for the system is as follows:
Manager Employee Guest
User 1 R W
User 2 R
User 3 R
User 4 W
User 5 W R W
where R denotes read access, W denotes write access, and - denotes no access.
a) How many permissions are explicitly defined in this access control matrix?
b) What is the total number of access control decisions that have to be processed when a user
requests access in this system?
c) If a new role called Analyst is added with read access to all resources, how many additional
access control entries need to be added to accommodate this change?
Solution 19. a) To find the number of permissions explicitly defined, we need to count the
number of entries in the access control matrix that are not "-", since each entry represents a specific
permission.
In this case, there are 5 users with 3 roles each, so the total number of permissions is 5×3 = 15.
b) The total number of access control decisions that have to be processed when a user requests
access can be calculated by counting the number of cells in the access control matrix, regardless
of whether they contain an actual permission or are set to "-".
In this case, there are 5 users with 3 roles each, so the total number of access control decisions
is 5×3 = 15.
c) When a new role called Analyst is added with read access to all resources, we need to add
read permissions for the Analyst role in each resource. Since there are 5 resources, the number
of additional access control entries needed is 5 (one for each resource).
18 20. LACK OF ACCESS CONTROL REVIEWS AND UPDATES.
Problem 20. A company has a database with sensitive information that only certain employ-
ees should be able to access. The access control list (ACL) for the database contains 100 user
accounts. After a recent review, it was found that 10 of these accounts belong to employees who
are no longer with the company and should no longer have access.
a) What percentage of the accounts in the ACL need to be removed due to lack of access
control updates?
b) If the company removes the accounts that should no longer have access, how many accounts
will remain in the ACL?
Solution 20. a) To find the percentage of accounts that need to be removed, we first calculate
the number of accounts that should be removed. Since there are 100 accounts in total and 10 of
them need to be removed, we have:
Number of accounts to be removed = 10
Next, we calculate the percentage of accounts to be removed:
Percentage of accounts to be removed =10
100 ×100% = 10%
Therefore, 10% of the accounts in the ACL need to be removed due to lack of access control
updates.
b) After removing the accounts that should no longer have access, the number of remaining
accounts in the ACL is:
Remaining accounts = Total accounts - Accounts to be removed Remaining accounts = 100 -
10 Remaining accounts = 90
Thus, 90 accounts will remain in the ACL after removing the accounts that should no longer
have access.
Probability =Number of favorable outcomes
Total number of possible outcomes =1
106=1
1000000 = 0.000001
Therefore, the probability of guessing the correct token on the first attempt is 0.000001 or
0.0001%. The attacker has a very low chance of successfully guessing the correct token on their
first attempt.
2 3. INADEQUATE PASSWORD POLICIES
Problem 3. Company XYZ has implemented a password policy where users must create pass-
words that are at least 8 characters long and contain at least one uppercase letter, one lowercase
letter, one digit, and one special character.
Suppose a user creates a password that is 10 characters long: "
P@ssw0rd
". Determine whether
this password complies with the company’s password policy.
Solution 3. To check if the password "
P@ssw0rd
" complies with the company’s password policy,
we need to ensure it meets all the requirements: 1) It is at least 8 characters long, 2) It contains
at least one uppercase letter, 3) It contains at least one lowercase letter, 4) It contains at least one
digit, 5) It contains at least one special character.
a) The password is 10 characters long, which meets the requirement of being at least 8 char-
acters long.
b) The password contains at least one uppercase letter "P".
c) The password contains at least one lowercase letter "s".
d) The password contains at least one digit "0".
e) The password contains at least one special character "@".
Since the password "
P@ssw0rd
" meets all the requirements of the company’s password policy,
it complies with the policy.
3 4. PERMISSION ESCALATION VULNERABILITIES
Problem 4. Consider a web application where users can access different levels of resources
based on their permissions. A user with a normal level of permission can only view resources,
while a user with an admin level of permission can both view and modify resources.
Suppose there is a vulnerability in the system that allows a user to escalate their permission
level. Specifically, a user with normal permission can exploit this vulnerability to gain admin privi-
leges.
a) If a normal user manages to escalate their permission level to admin, what potential risks or
damage could this vulnerability lead to?
b) How can this vulnerability be mitigated or prevented in the system?
Solution 4. a) If a normal user successfully escalates their permission level to admin, it can
lead to significant risks and damage to the system. With admin privileges, the user can:
- Modify critical resources, leading to data loss or corruption. - Access sensitive information that
they are not authorized to view. - Introduce malicious code or malware into the system. - Create
new admin accounts and compromise the system further.
In essence, the escalation of privileges can result in a complete compromise of the system’s
security and functionality.
b) To mitigate or prevent this vulnerability, the following measures can be taken:
- Regular security audits and code reviews to identify and fix such vulnerabilities. - Implement
proper access control mechanisms, ensuring that users can only perform actions that are within
their authorized permissions. - Utilize least privilege principles, where users are given only the
minimum level of access required to perform their tasks. - Implement strong authentication mech-
anisms to ensure that users are who they claim to be before escalating their permissions. - Monitor
user activities for any suspicious behavior or unauthorized privilege escalations.
4 5. UNAUTHORIZED ACCOUNT ACCESS
Problem 5. A company uses a two-factor authentication system where users must enter a
password and a one-time verification code sent to their registered email address. However, an
attacker gains unauthorized access to a user’s email account and can intercept the verification
codes. The attacker tries to access the user’s account by guessing the password by brute force
attack.
The password consists of 8 characters, where each character can be a lowercase letter, an
uppercase letter, a digit, or a special character (total of 94 possibilities). If the attacker can guess
1000 passwords per second, what is the expected time it will take for the attacker to successfully
guess the correct password?
Solution 5. The number of possible combinations for an 8-character password with 94 possi-
bilities for each character is 948.
The expected time it will take for the attacker to guess the correct password can be calculated
as the average time it takes to guess, which is half of the total number of possible combinations.
Hence, the expected time = 948
2×1000 seconds = 5595819309614084
2000 seconds 2.79790965480704 ×
1012 seconds.
Therefore, the expected time it will take for the attacker to successfully guess the correct pass-
word is approximately 2.798 ×1012 seconds.
5 6. AUTHENTICATION BYPASS TECHNIQUES
Problem 6. Consider a system that uses a token-based authentication mechanism. The token
generated for a user consists of a 10-character alphanumeric string. An attacker is attempting
to bypass the authentication by brute-forcing the system. Assuming the attacker can try 100,000
token combinations per second, calculate the time it would take for the attacker to guess the correct
token.
Solution 6. a) The number of possible combinations for a 10-character alphanumeric string
(consisting of uppercase letters, lowercase letters, and digits) is given by 6210.
6210 = 839,299,365,868,340,224
b) Given that the attacker can try 100,000 token combinations per second, we can calculate
the number of seconds it would take for the attacker to guess the correct token by dividing the total
number of combinations by the rate at which the attacker can try combinations.
839,299,365,868,340,224
100,000 = 8,392,993,658,683.40224 seconds
c) Converting the time to more meaningful units, we have:
8,392,993,658,683.40224 seconds
60 139,883,227,644.72337 minutes
139,883,227,644.72337 minutes
60 2,331,387,127.41206 hours
2,331,387,127.41206 hours
24 97,140,297.80967 days
Therefore, it would take the attacker approximately 97,140,297 days to guess the correct token
at a rate of 100,000 token combinations per second.
6 7. INSUFFICIENT AUDIT LOGGING
Problem 7. The security team of a company is concerned about the insufficient audit logging
in their authentication system. They decide to implement a more robust logging mechanism that
records all authentication events, including successful and failed login attempts. The current sys-
tem logs only successful login events.
The company has 100 employees, each of whom logs in to their system 5 times a day on
average. If the company operates 5 days a week, how many authentication events will the new
logging mechanism record in a month?
Solution 7. Given: - Total employees = 100 - Average login per employee per day = 5 - Number
of days in a week = 5 - Number of weeks in a month = 4
a) Number of login events per employee per week:
Login events per employee per week =Average logins per day×Number of days per week = 5×5 = 25
b) Total login events per week for all employees:
Total login events per week =Login events per employee per week×Total employees = 25×100 = 2500
c) Total login events in a month:
Total login events in a month =Total login events per week×Number of weeks in a month = 2500×4 = 10000
Therefore, the new logging mechanism will record 10,000 authentication events in a month.
I’m unable to provide numerical problems in this topic. Would you like a theoretical question
instead?
7 9. INSECURE PASSWORD STORAGE METHODS
Problem 9. A software application stores user passwords using an insecure method where
passwords are stored in plaintext format in a database. The application has a total of 5000 users,
and each user has a unique password. An attacker gains access to the database and is able to
retrieve all the passwords. Calculate the total number of passwords the attacker can potentially
obtain.
Solution 9. Since each of the 5000 users has a unique password stored in plaintext format,
the total number of passwords the attacker can potentially obtain is simply the number of users,
which is 5000.
8 10. INADEQUATE SESSION MANAGEMENT
Problem 10. A web application uses cookie-based session management for authenticating
users. The session IDs generated by the application are 10 characters long and consist of upper-
case letters, lowercase letters, and numbers.
a) Calculate the total number of possible session IDs that can be generated with this format.
b) If the session IDs are generated randomly, what is the probability of two users having the
same session ID out of the first 100 generated session IDs?
c) Determine the minimum length of a session ID required to ensure a collision probability of
less than 1% for the first 1000 generated session IDs.
Solution 10.
a) To calculate the total number of possible session IDs, we can calculate the total number of
characters (26 uppercase letters + 26 lowercase letters + 10 numbers = 62). The total number of
possible session IDs is then 6210.
6210 839299365868340224
Therefore, there are approximately 8.39 ×1017 possible session IDs that can be generated with
this format.
b) The probability of two users having the same session ID out of the first 100 generated session
IDs can be calculated using the formula for the birthday paradox. The probability of at least one
collision is given by:
16210 ×6110 ×... ×(62 99)10
6210 ×6210 ×... ×6210
Using this formula, we can calculate the probability as:
16210 ×6110 ×... ×3110
6210 ×6210 ×... ×5310 0.000126
Therefore, the probability of two users having the same session ID out of the first 100 generated
session IDs is approximately 0.0126%.
c) To determine the minimum length of a session ID required to ensure a collision probability
of less than 1% for the first 1000 generated session IDs, we need to find the smallest length that
satisfies:
162length ×61length ×... ×90210
62length ×62length ×... ×95310 <0.01
Solving this equation will give us the minimum length required to achieve a collision probability
of less than 1%.
9 11. DATA LEAKAGE THROUGH ACCESS CONTROL FLAWS
Problem 11. A company has an access control system in place where employees must use a
combination of a password and a security token to access sensitive data. The password must be
at least 8 characters long and contain at least one uppercase letter, one lowercase letter, one digit,
and one special character. The security token generates a 4-digit number that changes every 30
seconds.
If an attacker gains access to the employee database and discovers that 30
Solution 11. Let’s break down the problem into two parts: weak passwords and compromised
security tokens.
a) Weak Passwords: Given that 30
b) Compromised Security Tokens: Given that the security token generation algorithm is com-
promised with a probability of 10
c) Overall Probability of Unauthorized Access: To find the overall probability that an attacker
can gain unauthorized access using both weak passwords and compromised security tokens, we
multiply the probabilities of these events occurring:
Overall Probability = Probability of Weak Passwords ×Probability of Compromised Security
Tokens
Overall Probability = 0.3×0.1
= 0.03
Therefore, the overall probability that an attacker can gain unauthorized access to sensitive
data using a combination of weak passwords and compromised security tokens is 0.03 or 3
10 12. CREDENTIAL STUFFING ATTACKS
Problem 12. Considering a website that implements account lockout after 5 failed login at-
tempts. An attacker performs a credential stuffing attack using a list of 500,000 usernames and
passwords. If the attacker randomly tries each pair every 2 seconds, calculate how long it would
take for the attacker to test all credentials without any lockout mechanism in place.
Solution 12. Since there are 500,000 usernames and passwords to test, the total number of
attempts without any lockout mechanism is calculated as:
Total attempts =Number of usernames ×Number of passwords
Total attempts = 500,000 ×500,000 = 250,000,000,000
Given that the attacker tries a pair every 2 seconds, the total time in seconds to test all creden-
tials without any lockout mechanism would be:
Total time =Total attempts ×Time per attempt
Total time = 250,000,000,000 ×2seconds
Total time = 500,000,000,000 seconds
Converting this to days:
Total time in days =500,000,000,000
86400 5,787,037 days
Therefore, it would take approximately 5,787,037 days for the attacker to test all credentials
without any lockout mechanism in place.
11 13. ROLE ASSIGNMENT ERRORS
Problem 13. In a company’s access control system, there are four roles: Administrator (A),
Manager (M), Employee (E), and Guest (G). The company enforces the following rules for role
assignments:
- Administrators can assign any role to any user. - Managers can assign roles Employee and
Guest, but not Administrator. - Employees can only assign the Guest role. - Guests cannot assign
any roles.
If a user with the role Manager attempted to assign a role to another user, what are the possible
valid role assignments they could make?
Solution 13. Since Managers can only assign roles to Employees and Guests, the possible
valid role assignments a Manager can make are:
a) Assigning the Employee role to a user.
b) Assigning the Guest role to a user.
12 14. ACCESS CONTROL MISCONFIGURATIONS
Problem 14. Consider a system with three user accounts: Alice, Bob, and Charlie. The access
control list (ACL) for a specific resource on the system is as follows:
- Alice has read and write permissions. - Bob has read permissions. - Charlie has no permis-
sions.
If a request is made by each user to read the resource, calculate the access control decision
for each user.
Solution 14. a) Since Alice has both read and write permissions, her access control decision
for reading the resource is Granted.
b) Bob only has read permissions, so his access control decision for reading the resource is
also Granted.
c) Charlie has no permissions for the resource, so his access control decision for reading the
resource is Denied.
13 15. WEAK ACCESS CONTROL ENFORCEMENT
Problem 15. In a company, there are three access levels for their employees: Level 1, Level 2,
and Level 3. The company currently enforces weak access control by allowing employees at Level
1 to access all documents, employees at Level 2 can only access documents at Level 2 and below,
and employees at Level 3 can only access documents at Level 3.
a) If an employee at Level 1 tries to access a Level 2 document, what access control enforce-
ment issue arises?
b) If an employee at Level 2 tries to access a Level 3 document, what access control enforce-
ment issue arises?
c) How can the company improve their access control enforcement to prevent these issues?
Solution 15.
a) When an employee at Level 1 tries to access a Level 2 document, the issue of over-privilege
arises. This means that the employee has more access rights than necessary, violating the principle
of least privilege.
b) When an employee at Level 2 tries to access a Level 3 document, the issue of under-privilege
arises. This means that the employee does not have sufficient access rights to perform their job
tasks effectively.
c) To improve their access control enforcement, the company should implement the principle of
least privilege. This means granting employees the minimum level of access they need to perform
their job duties. They should also regularly review and update access control policies to ensure
they align with employees’ current roles and responsibilities. Additionally, implementing role-based
access control (RBAC) can help streamline access control management by assigning permissions
based on job roles rather than individual users.
14 16. SOCIAL ENGINEERING ATTACKS ON AUTHENTICATION MECHANISMS
Problem 16. An employee at a company receives an email from what appears to be the IT
department, asking for their username and password to update the system. The email looks le-
gitimate with the company logo and email format. The employee, unaware of social engineering
tactics, provides their credentials as requested. This is an example of a phishing attack.
a) If the company has a policy requiring employees to change their passwords every 90 days,
what steps should the employee take after falling victim to this attack?
b) How can the company educate its employees to recognize and avoid falling for phishing
attacks in the future?
Solution 16.
a) After falling victim to a phishing attack, the employee should immediately take the following
steps:
i) Change the password for their account: The employee should log in to the company’s sys-
tem using a secure method (such as going directly to the company’s website) and change their
password. This step ensures that the compromised password is no longer valid.
ii) Inform the IT department: The employee should report the incident to the IT department or
their supervisor so that appropriate measures can be taken, such as checking for any unauthorized
access and informing other employees to be vigilant.
b) To educate its employees and help them recognize and avoid falling for phishing attacks in
the future, the company can implement the following measures:
i) Phishing awareness training: Conduct regular training sessions for employees to educate
them on recognizing phishing emails, understanding the tactics used by attackers, and emphasiz-
ing the importance of verifying the legitimacy of any requests for sensitive information.
ii) Simulated phishing attacks: Conduct simulated phishing campaigns within the company to
test employees awareness and responses to phishing emails. This can help identify weak points
and provide further training where needed.
iii) Implement email filtering and authentication measures: Utilize email filtering tools to detect
and flag potential phishing emails before they reach employees’ inboxes. Additionally, implement
email authentication protocols such as SPF, DKIM, and DMARC to verify the authenticity of incom-
ing emails.
By implementing these measures, the company can better equip its employees to identify and
mitigate the risks associated with phishing attacks.
15 17. INSIDER THREATS COMPROMISING ACCESS CONTROL
Problem 17. A company uses employee ID badges with RFID technology for access control
to restricted areas. Each badge has a unique identifier code and a security level associated with
it. The security levels range from 1 (least privileged access) to 5 (most privileged access). An
employee with a security level of 2 should not be able to access areas restricted to security levels
4 and 5.
In a recent security breach investigation, it was discovered that an employee with a security
level 2 accessed a security level 5 area multiple times over the past month.
a) If the company has 100 employees, what is the probability that at least one employee with a
security level of 2 accesses a security level 5 area?
b) If the company wants to strengthen their access control mechanisms to prevent such breaches,
suggest two strategies they can implement.
Solution 17. a) To calculate the probability that at least one employee with a security level of 2
accesses a security level 5 area, we can use the complement rule. Let’s calculate the probability
that no employee with security level 2 accesses a security level 5 area and subtract that from 1.
The probability that an employee with security level 2 accesses a security level 5 area is defined
as P(access) = 1
5. Therefore, the probability that an employee with security level 2 does not access
a security level 5 area is 1P(access) = 1 1
5=4
5.
The probability that none of the 100 employees with security level 2 access a security level 5
area is (4
5)100 4.67 ×107.
Therefore, the probability that at least one employee with a security level 2 accesses a security
level 5 area is 1(4
5)100 0.9999995.
b) Two strategies the company can implement to strengthen their access control mechanisms
are:
1. Implementing two-factor authentication: This involves requiring employees to use a combi-
nation of something they know (e.g., a password) and something they have (e.g., the RFID badge)
to access restricted areas. This adds an extra layer of security to prevent unauthorized access.
2. Regular auditing and monitoring: The company should regularly audit access logs and moni-
tor employee access patterns to identify any anomalies or suspicious activity. By closely monitoring
access control systems, the company can quickly detect and respond to unauthorized access at-
tempts.
16 18. CROSS-SITE REQUEST FORGERY VULNERABILITIES
Problem 18. Suppose a website allows users to transfer money between accounts by sub-
mitting a POST request to the URL example.com/transfer. This website is vulnerable to cross-site
request forgery (CSRF) attacks. Each transfer request must include the sender’s account number,
the recipient’s account number, and the amount to transfer. An attacker tricks a logged-in user
into clicking a malicious link that transfers $500 from the user’s account to the attacker’s account.
Suppose the attacker posts the following form to the victim’s browser:
Field Value
Sender Account 12345
Recipient Account 67890
Amount $500
Given that the user’s account has a balance of $1500 and the attacker has already created an
account with account number 67890, answer the following questions:
a) What is the risk associated with this CSRF attack?
b) How can the website mitigate this vulnerability?
Solution 18.
a) The risk associated with this CSRF attack is that the attacker can potentially steal $500 from
the victim’s account without the victim’s consent or knowledge. This could lead to financial loss for
the victim and compromise the integrity of the banking system.
b) To mitigate this vulnerability, the website can implement measures such as:
- Using anti-CSRF tokens: Include a unique token in each request that is verified by the server
to ensure that the request is coming from a legitimate source.
- Implementing SameSite cookie attribute: Set the SameSite attribute on cookies to prevent
them from being sent in cross-site requests.
- Requiring additional authentication: For sensitive operations like fund transfers, prompt the
user to re-enter their password or use multi-factor authentication.
By implementing these measures, the website can reduce the risk of CSRF attacks and en-
hance the security of user accounts and transactions.
17 19. ACCESS CONTROL IMPLEMENTATION ERRORS
Problem 19. Consider a system that uses Role-Based Access Control (RBAC) for access
control. There are 50 users registered in the system, each assigned to one of the three predefined
roles: Manager, Employee, or Guest.
The access control matrix for the system is as follows:
Manager Employee Guest
User 1 R W
User 2 R
User 3 R
User 4 W
User 5 W R W
where R denotes read access, W denotes write access, and - denotes no access.
a) How many permissions are explicitly defined in this access control matrix?
b) What is the total number of access control decisions that have to be processed when a user
requests access in this system?
c) If a new role called Analyst is added with read access to all resources, how many additional
access control entries need to be added to accommodate this change?
Solution 19. a) To find the number of permissions explicitly defined, we need to count the
number of entries in the access control matrix that are not "-", since each entry represents a specific
permission.
In this case, there are 5 users with 3 roles each, so the total number of permissions is 5×3 = 15.
b) The total number of access control decisions that have to be processed when a user requests
access can be calculated by counting the number of cells in the access control matrix, regardless
of whether they contain an actual permission or are set to "-".
In this case, there are 5 users with 3 roles each, so the total number of access control decisions
is 5×3 = 15.
c) When a new role called Analyst is added with read access to all resources, we need to add
read permissions for the Analyst role in each resource. Since there are 5 resources, the number
of additional access control entries needed is 5 (one for each resource).
18 20. LACK OF ACCESS CONTROL REVIEWS AND UPDATES.
Problem 20. A company has a database with sensitive information that only certain employ-
ees should be able to access. The access control list (ACL) for the database contains 100 user
accounts. After a recent review, it was found that 10 of these accounts belong to employees who
are no longer with the company and should no longer have access.
a) What percentage of the accounts in the ACL need to be removed due to lack of access
control updates?
b) If the company removes the accounts that should no longer have access, how many accounts
will remain in the ACL?
Solution 20. a) To find the percentage of accounts that need to be removed, we first calculate
the number of accounts that should be removed. Since there are 100 accounts in total and 10 of
them need to be removed, we have:
Number of accounts to be removed = 10
Next, we calculate the percentage of accounts to be removed:
Percentage of accounts to be removed =10
100 ×100% = 10%
Therefore, 10% of the accounts in the ACL need to be removed due to lack of access control
updates.
b) After removing the accounts that should no longer have access, the number of remaining
accounts in the ACL is:
Remaining accounts = Total accounts - Accounts to be removed Remaining accounts = 100 -
10 Remaining accounts = 90
Thus, 90 accounts will remain in the ACL after removing the accounts that should no longer
have access.
Students also viewed