mhenr18 / injector

Code injection + payload communications for OSX (incl. sandboxed apps)
Other
23 stars 3 forks source link

Many API calls aren't error checked. #1

Open mhenr18 opened 10 years ago

mhenr18 commented 10 years ago

Title basically states the issue at hand. There's many API calls being made that might fail (read/write are excellent culprits) and there's zero checking/error handling happening for quite a few of them.

mhenr18 commented 10 years ago

Plans for indicating errors to the user (as there's no point in checking return values if we can't do anything to fail gracefully):

This leaves only two errors that can't be signalled easily to the user.

  1. Failure to find the signal file. We solve this by using a timeout in the injector.
  2. Failure to open the comms FIFO files in the payload (as the signal file has been written but we have no comms at this stage). Again, we solve this by using a timeout in the injector.

(A complete crash in the target process due to a segfault or some other fatal error would be resolved by the timeout being hit and us noticing that the target process has terminated)

I'm looking at a 10 second default timeout - this should be fairly lenient considering that the bootstrap payload runs as a new thread and so can't be blocked. If this becomes an issue I can add a flag to alter this behaviour.

An implementation of the timeouts to catch the last few errors also solves #7.

mhenr18 commented 10 years ago

Reassigned forward to the next release. In practice, things are stable enough and the common errors are handled gracefully. The timeout's been implemented too.