0
0
PHPprogramming~5 mins

File upload security risks in PHP - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a common security risk when allowing file uploads in PHP?
Uploading malicious files that can execute harmful code on the server, such as PHP scripts disguised as images.
Click to reveal answer
beginner
Why should you validate the file type during upload?
To ensure only allowed file types are accepted, preventing attackers from uploading dangerous files like executable scripts.
Click to reveal answer
intermediate
What is the risk of not limiting file size in uploads?
Attackers can upload very large files to exhaust server storage or cause denial of service by overloading resources.
Click to reveal answer
intermediate
How can storing uploaded files outside the web root improve security?
It prevents direct access to uploaded files via URL, reducing the chance of executing malicious files on the server.
Click to reveal answer
beginner
What is the purpose of renaming uploaded files?
Renaming files avoids overwriting existing files and prevents attackers from guessing file locations or executing scripts by name.
Click to reveal answer
Which of the following is a key risk when accepting file uploads in PHP?
AUploading a file smaller than 1KB
BUploading a text file with no content
CUploading a PHP script disguised as an image
DUploading a file with a .txt extension
What is a good practice to prevent execution of uploaded files?
AAllow all file types
BDisable file size limits
CUse the original file name
DStore files outside the web root directory
Why should you check the MIME type of an uploaded file?
ATo verify the file is of an allowed type
BTo increase upload speed
CTo reduce file size
DTo rename the file automatically
What can happen if you do not limit the size of uploaded files?
AServer storage can be exhausted
BFiles will upload faster
CFiles will be automatically deleted
DUsers can upload only images
Renaming uploaded files helps to:
AMake files larger
BPrevent overwriting and guessing file paths
CAllow execution of scripts
DDisable file uploads
Explain the main security risks involved with file uploads in PHP and how to mitigate them.
Think about how attackers might use file uploads to harm the server.
You got /5 concepts.
    Describe best practices to securely handle file uploads in a PHP application.
    Focus on steps that reduce risk of malicious files and server overload.
    You got /5 concepts.