Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
lucianocn opened this issue Sep 22, 2013 · 3 comments
Closed

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

lucianocn opened this issue Sep 22, 2013 · 3 comments

Comments

@lucianocn
Copy link

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;
}
@dreamsxin
Copy link
Contributor

$getParameter = $this->request->getQuery($parameter, $type, $default, FALSE, TRUE);

@dreamsxin dreamsxin mentioned this issue Sep 22, 2013
@lucianocn
Copy link
Author

@dreamsxin Thank you!

@dreamsxin
Copy link
Contributor

@lucianocn You're welcome, I should be doing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants