Skip to content

Dynamic (and secure) curl requests via sqlpage.exec()? #215

Answered by lovasoa
matthewlarkin asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, that's a fair assumption. Your previous example is not only guaranteed not to call anything other than curl, but also to pass only valid json to it. It is safe from shell injection.

Even sqlpage.exec('curl', $attacker_controlled) would be safe from shell injection (in that it would execute nothing other than curl with a single argument, whatever the attacker does).

As a general rule of thumb, the first argument to sqlpage.exec should always be hardcoded to a known safe program. It is in your case.

The only security issue I see in your example, as I said, is the lack of validation of the destination address (and maybe the subject line).

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
4 replies
@matthewlarkin
Comment options

@lovasoa
Comment options

Answer selected by matthewlarkin
@lovasoa
Comment options

@matthewlarkin
Comment options

Comment options

You must be logged in to vote
1 reply
@matthewlarkin
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested functions Related to built-in sqlpage functions
2 participants