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

Xpath injection #10162

Closed
cgocast opened this issue Aug 30, 2023 · 2 comments
Closed

Xpath injection #10162

cgocast opened this issue Aug 30, 2023 · 2 comments

Comments

@cgocast
Copy link
Contributor

cgocast commented Aug 30, 2023

The following functions are vulnerable to Xpath injection as explained at https://owasp.org/www-community/attacks/XPATH_Injection

function queryXmlExpression(SimpleXMLElement $xml) : array|false|null {
    $expression = $_GET["expression"];
    return $xml->xpath($expression);
}       

function queryDomExpression(DOMXPath $xpath) : mixed {
    $expression = $_GET["expression"];
    return $xpath->query($expression);
}         

function evaluateDomExpression(DOMXPath $xpath) : mixed {
    $expression = $_GET["expression"];
    return $xpath->evaluate($expression);
}

Psalm returns no issue when run with --taint-analysis.

I'll write a PR in order to raise a new issue named TaintedXpath

cgocast added a commit to cgocast/psalm that referenced this issue Aug 30, 2023
@psalm-github-bot
Copy link

Hey @cgocast, can you reproduce the issue on https://psalm.dev ?

@cgocast
Copy link
Contributor Author

cgocast commented Sep 4, 2023

Fixed by #10163

@cgocast cgocast closed this as completed Sep 4, 2023
This was referenced Feb 9, 2024
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

1 participant