Skip to content

SQL Injection with default blueprints in Waterline #5347

@jamsea

Description

@jamsea

I have a model called "patients" which is using the default find blueprint in sails (it's controller definition is just module.exports = {};). I have a sinking suspicion it may have to do with node-mysql not actually supporting prepared statements (https://github.com/felixge/node-mysql#escaping-query-values).

I'm able to recreate the issue on any string field by passing in \\\" in "startsWith" as a where criteria. E.g. this:

http://localhost:3000/v1/patients?where={"firstName":{"startsWith":"\\\" OR 1=1; -- "}}

Returns all records in the patients table. Scary.

I have:

 "sails": "^0.11.2",
 "sails-mysql": "^0.11.0"

In my package.json. Has anyone else experienced anything similar?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions