Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 543433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:33:03+00:00 2026-05-13T10:33:03+00:00

Hello I have a couple questions about PHP exec() and passthru(). 1) I never

  • 0

Hello I have a couple questions about PHP exec() and passthru().

1)
I never used exec() in PHP but I have seen it is sometimes used with imagemagick. I am now curious, what is some other common uses where exec is good in a web application?

2)
About 6 years ago when I first started playing around with PHP I did not really know anything, just very basic stuff and I had a site that got compromised and someone setup there own PHP file that was using the passthru() function to pass a bunch of traffic throught my site to download free music or video and I got hit with a 4,000$ bandwidth charge from my host! 6 years later, I know soo much more about how to use PHP but I still don’t know how this ever happened to me before. How can someone beable to add a file to my server through bad code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:33:04+00:00Added an answer on May 13, 2026 at 10:33 am

    1] Exec() is really useful when you:

    A) Want to run a program/utility on the server that php doesn’t have a command equivalent for. For example ffmpeg is common utility run via an exec call (for all sorts of media conversion).

    B) Running another process – which you can block or NOT block on – that’s very powerful. Sometimes you qant a pcnt_fork though, or similar, along with the correct CL args for non blocking.

    C) Another example is when I have to process XSLT 2.0 – I have to exec() a small java service I have running to handle the transformations. Very handy. PHP doesn’t support XSLT 2.0 transformations.

    2] Damn that’s a shame.
    Well, lots of ways. Theres a family of vulnerability called, “remote file include vulns”, that basically allow an attacker to include arbitrary source and thus execute it on your server.
    Take a look at: http://lwn.net/Articles/203904/

    Also, mentioned above, say your doing something like (Much simplified):

    exec("someUnixUtility -f $_GET['arg1']"); 
    

    Well, imagine the attacker does, url.come?arg1=”blah;rm -rf /”, your code will basically boil down to:

    exec("someUnixUtility -f blah; rm -rf /");
    

    Which in unix, you separate commands w/the ; So yeah – that could be a lot of damage.

    Same with a file upload, imagine you strip the last four chars (.ext), to find the extension.
    Well, what about something like this “exploit.php.gif”, then you strip the extension, so you have exploit.php and you move it into your /users/imgs/ folder. Well, all the attacker has to do now is browse to users/imgs/exploit.php and they can run any code they want. You’ve been owned at that point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a couple of questions about Hello World in Clojure: (println Hello, world!)
I have a couple of questions about the way I call methods in EL.
I have asked a couple of questions about this for loop: String[] book =
I know there's a couple of questions about this out there but I still
Hello I have next function, what always return null as result, but service calling
hello i have just start using Raphael but i'm very confused in the following
Hello i am having some problems generating random numbers with C# Now i have
I am learning java ee right now. I have successfully implemented a hello-world style
I have a compiling problem. I followed tutorial about Hello world program for Android
I have a couple of questions regarding a modular GWT based application framework. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.