If I have a keylogger on Windows 10, can it affect me when I boot into Ubuntu on the same computer.
No: when you boot into Ubuntu, programs stored on the Windows 10 partition cannot be run and cannot log what you are doing on Ubuntu.
Windows also can not store files on an Ubuntu system since it does not recognize ext4 filesystems.
So for a virus/keylogger/whatever to infest Ubuntu, it would need to magically move itself to something you can open in Ubuntu. You need to activate that something by making it executable, clicking it in Ubuntu to run it and it would need to have valid instructions for an Ubuntu system to be able to run.
Not going to happen any time soon.
A possible method (but it is a stretch): from Windows you get infected by UEFI malware; when Ubuntu is booted it copies some software over to your Ubuntu system and executes itself. (that is assuming something can be copied over from an UEFI partition to another partition).
As some comments have already stated, it's absolutely possible that a malware can jump between different operating systems on dual boot. There are only two barriers the malware must overcome:
- It must bring its own ext3/4 driver to handle the file system used by Ubuntu
- It must run with high privileges in order to access the required APIs
Everything else is just a question of the attackers intentions and skill. I don't know any case where "COTS" class malware did this. But when you look at some "weapon" class of malware you'll see modules to persist in BIOS or even the firmware of your hard drive. You will also see that it's highly modular so that every kind of functionality can be added at any time. So if the attacker thinks its necessary, there will be a module for it.
However if you are using full disk encryption (not only /home) it's much harder to jump over.
Otherwise the attacker could just modify existing binaries or scripts which are executed by default by the system.
Depending on if the "malware" was coded to look for dual boot configs which many rarely do as it adds many, MANY more lines of code and is an overall headache, but i wouldnt put it past microsoft to do so.... if it can check for dual boot systems it would most likely remain in the bootsector, reason for the bootsector would be to detect the presence of a grub loader, which, id suggest poking around there with EXTREME caution, and it would be worth seeing if you could modify the "malware" so that it was unusable, but still showed as though it remained on your system.