You can totally hack a plane using a buffer overflow. C airlines don’t check how many tickets they sell on a single flight. Usually if you overbook a flight, they will simply reallocate some of their buffer into business class. However, if you buy a bunch of tickets to one flight at once, you can craft a scenario where you overwrite the pilot.
Nope, actually this used to work but the genius computer scientists at Boeing put the cockpit in a random place around the cabin, thwarting most pilot overwrite attacks.