TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Exploit/bypass PHP escapeshellarg/escapeshellcmd functions

19 pointsby josephscottabout 7 years ago

3 comments

chugabout 7 years ago
The title on this seems pretty misleading.<p>This is really a guide on how to use the escapeshellarg when you should use escapeshellcmd (or the opposite). Of course, the API of system() is pretty awful, so there <i>is</i> an issue here in the form of &quot;wow, PHP makes this really easy to mess up,&quot; but there&#x27;s no actual exploit in either function mentioned. Just exploits in code people write using them. I guess the LANG one is arguably an actual exploit though, though that gets into arguing semantics.<p>Edit: there&#x27;s also an example that is missing quotes around an argument. Again, something very easy to mess up, but that&#x27;s what you get when you have a function that is basically like typing a line into the shell.
评论 #16937413 未加载
merittabout 7 years ago
I&#x27;m confused how a list of clever ways to get executables to initiate other executables is somehow an &quot;exploit&quot; of a programming language offering a system(3) call?<p>How about we just don&#x27;t run system calls, especially none that contain any amount of user input.
labsterabout 7 years ago
Ah yes, &quot;PHP &quot;security&quot;&quot;. Yes, untrusted user input going to the shell is a bad idea, even when &quot;sanitized&quot;.<p>Of course, unlike other saner languages, bypassing the shell isn&#x27;t always an option. When running under Apache, pcntl_exec() isn&#x27;t available, so you just gotta hope rely on escapeshellarg(), addbackslashes(), and prayer.
评论 #16936816 未加载
评论 #16936763 未加载