May the file size returned by stat be compromised?

Posted by codeholic on Server Fault See other posts from Server Fault or by codeholic
Published on 2010-04-13T06:27:54Z Indexed on 2010/04/13 6:33 UTC
Read the original article Hit count: 303

Filed under:
|
|
|
|

I want to make sure that nobody changed a file. In order to accomplish that, I want not only to check MD5 sum of the file, but also check its size, since as far as I understand this additional simple check can sophisticate falsification by several digits.

May I trust the size that stat returns? I don't mean if changes were made to stat itself. I don't go that deep. But, for instance, may one compromise the file size that stat returns by hacking the directory file? Or by similar means, that do not require superuser privileges?

It's Linux.

© Server Fault or respective owner

Related posts about filesystem

Related posts about security