menu

PHP Security


1. Which of the following is a method to prevent Remote Code Execution vulnerabilities in PHP?

Using SSL encryption

Restricting access to sensitive files

Using the extract() function

Input validation and sanitization


2. Which of the following is a method to prevent file inclusion vulnerabilities in PHP?

Using SSL encryption

Restricting access to sensitive files

Using the extract() function

Using the $_REQUEST superglobal variable


3. What is the purpose of the password_verify() function in PHP?

To encrypt data before storing it in a database

To hash passwords before storing them in a database

To validate user input

To convert special characters to HTML entities


4. Which of the following is a method to prevent Cross-Site Request Forgery (CSRF) attacks in PHP?

Using SSL encryption

Verifying the HTTP referrer header

Storing session data in cookies

Using a CAPTCHA


5. Which of the following is a method to prevent file inclusion vulnerabilities in PHP?

Using SSL encryption

Disabling file inclusion functions

Storing files outside the web root directory

Storing files in plaintext


6. What is the purpose of the strip_tags() function in PHP?

To encrypt data

To validate user input

To remove HTML tags from a string

To generate random strings


7. Which of the following is a method to prevent session hijacking attacks in PHP?

Storing session IDs in plaintext

Using a fixed session ID

Using SSL encryption

Disabling session IDs


8. What is a Session Hijacking attack?

A type of Cross-Site Scripting attack

A method to bypass firewalls

A vulnerability that allows an attacker to steal a user's session ID and take over their session

A type of Denial-of-Service attack


9. What is a SQL injection vulnerability?

A vulnerability that allows an attacker to execute arbitrary code on a system

A vulnerability that allows an attacker to include a file from a remote server

A vulnerability that allows an attacker to bypass authentication

A vulnerability that allows an attacker to manipulate database queries


10. What is the purpose of the session_regenerate_id() function in PHP?

To regenerate the session ID

To destroy the session

To validate user input

To convert special characters to HTML entities