I was wondering what if I would get a virus on Ubuntu, could it then also infect my Windows?
Short answer
By the virus that infected Linux? Maybe.
Portable malware
There do exist some cross-platform viruses, but they tend to be rare because operating-systems are like languages; there may be some overlap, but there is usually enough difference that you cannot simply plug-and-play something into different ones without modification or special handling.
In the book Shellcoder’s Programming Uncovered, Kris Kaspersky (no relation to the anti-virus) explains how it is difficult to write a virus that is compatible across different Linux versions because they use different mechanisms and are incompatible enough that you cannot simply use a single method that works on them and gives some examples of shellcode for different Unix/Linux systems. If it is difficult to write a virus that works across Linux, imagine how hard it would be for it work on Windows as well.
He actually says that most hacker are defeated because of insufficient attention to [portability]. This just further demonstrates that anything that would be that effective would be written by extremely dedicated hackers who are almost certainly getting something significant out of it (money), and that such viruses are usually part of organized crime and target more lucrative targets than the general populace (think Stuxnet).
Worms
Network worms tend to be the most common cross-platform malware because they don’t use low-level system access or OS-specific exploits, but rather higher-level components. These can certainly jump OSes, like something that uses JavaScript to do its dirty work or something that mails itself to everyone in your address book.
Trojans
Your Windows installation is more likely to be at risk by a trojan that uses Linux as an infection vector, but carries a Windows payload. This is much more common than a cross-platform virus, and also works with Apple (an Apple virus that targets Windows). That said, trojans of this variety are still less common than worms.
Boot-record virus
Since Linux is booting on the system, it will have access to the HDD where Windows lives. This means that even if you use BitLocker to encrypt the files on the drive so that a virus in Linux has no access to the file-system in Windows, it can still infect the boot-record and hide a virus in some parts of the disk so that the next time you boot Windows, it gets injected. However this requires a fairly advanced virus to bypass all of the security components that Windows 7 uses to keep clean. Again, these are not too common.
Summary
In general, cross contamination isn’t usually a problem because just like with biological viruses, different OSes tend to be incompatible enough that there is just not enough payout to bother evolving something that can infect both (no, you can’t catch a cold from your pet or infect them with yours).
Precautions
However, this does not mean you should get lax with security. There are a few things you should do:
- Harden your Windows installation by disabling everything you don’t need, applying all updates, using some kind of anti-malware
- Harden your Linux installation in the same way
- Limit the files that you pass between them to media, (though even those can be infected). You said you don’t intend to pass any files, but you should usually be safe with files from trusted sources.
With even a little prevention, you can usually be safe.