Skip to content
Software development
ASD ISMISM-1276

ASD ISM 1276 Use safe database query methods

What it says

Parameterised queries or stored procedures, instead of dynamically generated queries, are used by software for database interactions.

Quoted as published. Everything else on this page is written by Control Stack.

What it means

In plain English

Software should use parameterised queries or stored procedures to safely access databases.

When software needs to access a database, it's crucial to use safe methods like parameterised queries or stored procedures. Doing this prevents hackers from manipulating your database with harmful queries. If you don't, you risk exposing sensitive business or customer data, which can lead to financial and reputational harm.

Why it matters

Not using parameterised queries or stored procedures can enable SQL injection, leading to unauthorised data access, data loss, and service disruption.

How to implement

  1. Database administrators should ensure all software uses parameterised queries instead of building database queries from scratch.

    This can be achieved by teaching developers how to use programming libraries and frameworks that support this feature.

  2. IT teams need to review all software that interacts with the database to confirm it uses stored procedures for data access.

    Stored procedures should be developed and tested to handle expected data and scenarios, reducing the risk of unexpected database commands.

  3. Software developers should work with database specialists to convert existing database access code into parameterised queries or stored procedures.

    This involves identifying parts of code where database queries are created, then refactoring these to use secure methods.

  4. Project managers should schedule regular training sessions for developers on secure coding practices, including the use of parameterised queries.

    Practical workshops are effective, focusing on real examples where input validation reduces risks.

  5. Management should enforce a policy where new software or updates must be reviewed by a security expert before being deployed.

    This ensures every piece of software adheres to the best practices in accessing databases safely.

Keep it running

Review application code and ORM usage to ensure all SQL uses parameterised queries or stored procedures; test for SQL injection in CI and during releases.

Evidence and audit

  1. Check 1 of 5What an auditor asks for

    Ask for

    The list of applications that interact with databases.

    Look at

    Their documentation to check whether parameterised queries or stored procedures are used for each database interaction. Good practice is a documented process showing parameterised queries are the standard approach.

  2. Check 2 of 5What an auditor asks for

    Look at

    Whether these samples match best practices for using parameterised queries and avoid direct query string construction.

    Good evidence

    Is code that makes use of libraries known for their secure query capabilities.

  3. Check 3 of 5What an auditor asks for

    Ask for

    Policy documents regarding database access methods. Look to see if there's a clear mandate to use parameterised queries and stored procedures.

    Good evidence

    Sign is a policy with detailed procedures and examples, approved and up to date.

  4. Check 4 of 5What an auditor asks for

    Ask for

    Training records regarding secure database access methods.

    Look at

    Evidence that developers attended and understood secure coding practices, with a focus on parameterised queries. A positive sign is a record of regular session attendance and post-training assessments.

  5. Check 5 of 5What an auditor asks for

    Ask for

    To see logs or records of software changes related to database access.

    Look at

    Notes or comments indicating that the database interactions have been updated to use safe methods.

    Good evidence

    Is a detailed change log reflecting conscious updates to secure interactions.

Mappings

Closest match in ISO/IEC 27001: A.8.25, Secure development lifecycle, which this control partially meets.

ISO 27001

ISO/IEC 27001: 2 mappings

  • A.8.25Secure development lifecyclePartially meets

Mappings show how controls relate across frameworks. They do not imply full equivalence or certification.