CS Professional · Artificial Intelligence, Data Analytics and Cyber Security - Laws and Practice · Softwares and Software Security
A company's web form builds a database query by directly joining user-typed text into the SQL string. Which control is the most effective primary defence against SQL injection in this code?
Parameterised queries, also called prepared statements, are the most effective primary defence. They separate user-supplied data from the SQL command, so injected text is treated only as data and cannot change the query. The other measures do not address unsafe query construction.
- AUsing parameterised queries (prepared statements)Correct
- BIncreasing the password length of database users
- CEncrypting the database backup files
- DHiding the web server version banner
Explanation
SQL injection occurs because user input is interpreted as SQL code. Parameterised queries keep data separate from the command structure, so injected text cannot alter the query. Strong passwords, backup encryption and banner hiding do not stop malicious input from changing the query logic.
Did you get it right without looking?
One question tells you little. A timed set on Softwares and Software Security shows your real accuracy, how long you take and where you lose marks.
More Softwares and Software Security questions
- Meridian Textiles Pvt Ltd installs a single-user licensed accounting package on 25 office computers after purchasing only one licence. Which…
- An employee at a Pune company downloads a free utility. It appears to work as advertised but secretly lets a remote person control the compu…
- Which feature distinguishes a copyleft open-source licence such as the GNU General Public License from a permissive licence such as MIT?
- Sharma Textiles uses a licensed accounting package. An employee installs a cracked copy of the same package on a personal computer. Under In…
- A manufacturing firm's staff find that a vendor's software has a serious flaw that is not yet known to the vendor, and attackers are already…
- A disgruntled software engineer at an Indian firm embeds code in the payroll system that will delete salary records if his own employee ID i…