iSECPartners / yontma

You'll never take me alive.
Other
86 stars 18 forks source link

Improper behavior when device was never plugged in #14

Open mlynch-isec opened 11 years ago

mlynch-isec commented 11 years ago

If the device starts off with AC disconnected and the user locks the screen, YoNTMA hibernates the device immediately.

To reproduce:

  1. Install and run YoNTMA
  2. Disconnect AC power
  3. Lock machine

Expected: Machine remains powered on in locked state

Actual: YoNTMA instantly forces machine into hibernation

mlynch-isec commented 11 years ago

We can fix most of this pretty simply by exiting the AC monitoring thread if we start off disconnected.

Do we want to do something more complex like handle the case where the user starts off disconnected, locks, and then plugs in AC? The same applies to Ethernet. Do we want to start monitoring wired Ethernet connections that were initiated after the laptop was locked?

mlynch-isec commented 11 years ago

Andreas - what do you think? Hold open until we handle the lock > plug in > disconnect case or is this sufficient?

andreasjunestam commented 11 years ago

The cleanest approach is probably to do two things:

  1. Only run the monitoring threads when the machine is locked.
  2. Only trigger on the change in AC and ether, not the state of it. As in, only trigger hibernation when AC goes from up to down and when ehter goes from up to down. The ethernet code already does this.
mlynch-isec commented 11 years ago

We already were doing (1). With (2), we're now doing it for Ethernet and AC as of change d2ea136 (above). The problem is we're only tracking when AC goes from up to down when it started as up. Consider the scenario:

User unplugs laptop -> locks screen -> plugs in laptop -> unplugs laptop.

YoNTMA doesn't hibernate in this scenario because at lock time, it will check if AC is plugged in, see that it's not, and stop monitoring.

The question is do we want to hibernate in the scenario above (i.e. monitor for up->down transitions even when we started in down).

andreasjunestam commented 11 years ago

We could restart the monitoring thread on the down->up change if the machine is locked. Would solve it.

mlynch-isec commented 11 years ago

Moving to post v1.0.