Skip to content

[NFR] MongoDB Request Injection Attacks (getQuery/getPost) #1265

Closed
@lucianocn

Description

I'm using Phalcon with MongoDB and I think about a possible improvement at getQuery/getPost, which allow to receive arrays, like:
http://localhost?variable[]=value (also occurs with Post)

There`s a vulnerability, when using MongoDB, by parsing arrays in parameters. Its a good idea to add this check to Phalcon core.

About Request Injection Attacks:
http://php.net/manual/en/mongo.security.php

public function getParameter($parameter, $type = 'string', $default = '')
{
    $getParameter = $this->request->getQuery($parameter, $type, $default);

    if (is_array($getParameter)) {
        throw new Exception("Parameter '$parameter' cannot be an array.", 400);
    }
    return $getParameter;
}

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