PENTESYS POINT OF VIEW · ENGINEERING · 3 min read

Part of Validate insights →

SQL injection prevention and remediation verification

Keep untrusted values separate from query structure and verify the actual database-access paths.

Technical review lead: James Hinton · Offensive security lead

OUR POSITIONFix the way queries are constructed, then verify related paths; blocking one suspicious input pattern is not a complete correction.

Fix the way queries are constructed, then verify related paths; blocking one suspicious input pattern is not a complete correction.

01

Identify where query structure is created

Trace the application path from input to the database call, including reports, background work and administrative functions. Determine which values influence a query and whether any are being combined with executable query text. A visible error or a scanner observation is a starting point for investigation, not an explanation of every affected data-access path.

02

Use parameterised value handling

Use the database library's supported parameter binding for data values rather than constructing executable query text from them. Review the actual call, not merely the presence of an ORM in the project. Raw-query features, stored routines and helper functions can still introduce unsafe construction. Separate concerns so code review can see which parts define the operation and which parts supply data.

03

Treat dynamic structure separately

Some applications choose identifiers, sort behaviour or optional clauses dynamically. Those choices need a controlled design rather than an assumption that ordinary value parameters cover every part of a query. Prefer fixed query shapes and explicit allowed choices where practical. Review whether the feature requires dynamic structure at all before adding another escaping or filtering layer to a complicated construction process.

04

Limit the consequence and remove unsafe assumptions

Use the privileges the application actually needs and keep production data and credentials appropriately protected. These measures can reduce consequence but do not replace correcting unsafe query construction. Avoid exposing unnecessary database error detail to users. Consider whether the same query-building pattern is repeated in other modules so the remediation addresses a cause rather than a single failing request.

05

Verify with controlled evidence

Under explicit authorisation, confirm the affected behaviour has changed and that legitimate queries, unusual data values and relevant error paths still behave as intended. Use test records and agreed methods. Retain the application version, affected operation and result, and add regression coverage around the query boundary. A filter that rejects one observed input is weaker evidence than a reviewed and tested change to how the operation is built.

Sources and further guidance

Start with the complete guide

Use the essential guide for the wider scope, process and buying context behind this analysis.

Read “Penetration testing: scope, process, costs and what happens after the report” →
Editorial note

This current engineering guide replaces the retired legacy topic. Apply the recommendations to the actual application and verify changes within an authorised scope.

TALK TO PENTESYS

Apply this guidance to your environment.

Tell us what you need to understand, test or prove. We'll help you choose a proportionate next step—without forcing the conversation into a predefined package.

Apply this to my environment →Explore Validate

More Pentesys analysis

Pentesys trust and assurance

Recognised credentials. Responsible AI. Experienced people.

Clear evidence of our company standards, testing services and access to AI programmes.

Independent company assurance

CREST member company for Penetration Testing in EMEA

CREST member company

Penetration Testing in EMEA. Company standards independently assessed by CREST.

Valid until 1 November 2026View company certificate
CREST Security Testing accreditation for penetration testing

CREST-accredited human-led penetration testing

Independent assurance for Pentesys’s human-led penetration-testing service.

Human-led testingView CREST listing

AI-enabled testing assurance

CREST accreditation for AI-enabled penetration testing

CREST-accredited AI-enabled penetration testing

Pentesys is one of the first ten companies worldwide accredited by CREST for AI-enabled penetration testing. The accreditation assesses the responsible, secure and appropriate use of AI in penetration-testing services.

AI-enabled penetration testingView CREST announcement

Responsible-AI commitment

CREST AI Charter signatory

CREST AI Charter signatory

A separate commitment to responsible, transparent and accountable use of AI in cybersecurity.

Responsible-AI commitmentAbout the CREST AI Charter

Secure organisational baseline

Cyber Essentials certified

Cyber Essentials certified

Pentesys is certified across the whole organisation against the Cyber Essentials baseline controls.

Recertification due 12 August 2027View Cyber Essentials certificate

Controlled AI programme access

Pentesys participates in Anthropic’s Cyber Verification Program (CVP) for Claude and has approved access to OpenAI Daybreak Blue.

Anthropic CVP for Claude

Participation in Anthropic’s Cyber Verification Program.

Programme participationAbout Anthropic CVP

OpenAI Daybreak Blue

Approved access for defensive cybersecurity work.

Approved programme accessAbout Daybreak Blue

CREST accreditation applies to Pentesys’s service delivery, not to an AI model, the Portal or an appliance.

Meet the expertise behind our testing