While I was away from my home I needed to do some work on a java program so I booted a friends netbook(windows 8) I had with me and finished most of the works I needed to do there. Tho when I returned home I realized that the netbook didn't have antivirus, firewall and nothing security wise turned on which made me worry.

I now want to transfer these files(.java) to my main ubuntu desktop system but I am worried that something might have hidden itself inside the files header and other places, is there a way to verify the integrity of the files or a way to safely transfer the code they contain without accidentally transferring anything malicious and since these files are actually going to be compiles and put on production I'm double worried about that.

  • You can use hash sums or digital signature for that. Commented Mar 29, 2014 at 11:09
  • Text files do not have hidden headers. What revision control software are you using?
    – CL.
    Commented Mar 29, 2014 at 11:11
  • @KarolBabioch Not if the file was intentionally modified by me on that netbook I have no way of verifying something else didn't hide its way in there.
    – user36976
    Commented Mar 29, 2014 at 11:12
  • @CL. You mean version control? We use Git
    – user36976
    Commented Mar 29, 2014 at 11:12

2 Answers 2


Because mythical imagined malware that might subtly modify your unique proprietary source code is very unlikely to exist, there are a couple of slightly more real threats you could check for.

If your friend's computer was compromised by a human hacker, the hacker could have copied your code to his computer, studied it, changed it, and uploaded his changes back to your friend's computer. (This presumes an attacker who knows who you are, exactly what you are working on, how to find it, and has the means and motivation to carry out such an attack.) As the developers, you are the only people who would be in a position to know this, and a simple code review should easily satisfy you that this didn't take place.

Another remote possibility might be that this mythical malware hid something in an alternate data stream inside your code. While this could theoretically be possible, there is nothing on your computer that would automatically extract the payload from the ADS and execute it, so it won't simply infect your computer to copy it in. If it's a known virus, your own computer's anti-virus would detect it. Even if the ADS contained a virus, it still wouldn't have a way to execute to compromise your system. If you want to go with full-blown movie-plot paranoia, this mythical malware could have planted some kind of "illegal" data in an ADS inside your files, as part of a complicated blackmail scheme.

Frankly, the only plausible scenario of risk is that the media containing your files could have been infected by this mythical malware. Are the files now on a flash drive? Copy them off the flash drive using a Linux machine (which will be immune to Windows executable viruses and autoruns kinds of attacks.) Don't copy any files other than the valuable source files. Java source code files are fine, but PDFs, JPGs, EXEs, TTFs, DOCs, and everything else is not. After you have saved the needed files, format the flash drive. You can then use a tool like sdelete with the -z option to overwrite the bits in the drive, then sell the flash drive on eBay.

  • Soooo basically just do a code inspection and everything is ok? :P I was going full paranoid mode because these files are going straight into production.
    – user36976
    Commented Mar 29, 2014 at 14:05
  • @Nick And if you know your code is good, make sure to get it signed so it can't be tampered with after compilation.
    – Kevin Li
    Commented Mar 29, 2014 at 15:49

Since these are .java / text files, all changes are visible; there is no decompression/unpacking/reversing required here.

Since you use Git, my best suggestion would be to see the changes done form your previous commit and the last one. You can see all the changes done to the file and make sure there is nothing malicious code added to it. Git has a great way to do side by side comparison.

  • 2 of the files are unique, no revision available
    – user36976
    Commented Mar 29, 2014 at 11:16
  • That would mean a source code audit. Tools such as IBM's appscan exist to help you with this task.
    – ndrix
    Commented Mar 29, 2014 at 11:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .