My keyboard is typing by itself, could there be a ghost in it?

If it is still in warranty, save yourself the hassle and just get it repaired or replaced.

If it is out of warranty, it could be one of a few things and there is no easy way to tell.

  1. Malware (unlikely): Test via going to an Ubuntu or similar boot disk and open notepad/command line and see if the same thing happens
  2. Loose Connection: Try taking the keyboard and reseating it. A bit of dust may have got on the connector, or it could just be loose. Putting a bit of pressure on the keyboard may be making a short circuit.
  3. Bad Keyboard: It’s just faulty, need to replace it.
  4. Bad Motherboard: Worst of the worst. A friend had an Acer laptop with a very similar diagnosis, it turned out that the same thing happened even with a new keyboard, but not USB keyboard. So the only thing I could say was the motherboard was faulty.
  5. Debris: There might be some debris, like a paperclip or food, stuck under or between the keys. Try prising the keys off and shaking the keyboard upside-down to loosen it.
  6. Ghost: Like your title says, there could actually be a ghost in there!