Can flight data recorders be hacked?
Yes.  Black boxes aren't designed to be tamper-resistant.

The hard part is not the physical act of tampering with a black box, it's constructing a coherent false narrative of what happened during the time period.  The FDR records 80+ channels of data, which an investigator can correlate against each other, against data in the quick access recorder, against ACARS reports, and against the physical condition of the airplane itself.

For example, say you want to "prove" that an airplane's engines were shut down mid-flight, leading to a crash.  You could modify the FDR's record to show a throttle setting of "closed" and an engine RPM of 0, but the exhaust temperature would still be high, the fuel tank levels would still be dropping, and analysis of damage to the turbine blades would show a mix of axial and circumferential bending around the entire circumference of the blade disk, rather than the pure axial bending on a single side that would be expected if the engines had stopped spinning.