I read some articles about hacks that have hacked routers which inject ads on websites a visitor visits that replace adsense ads
Information Security Stack Exchange is a question and answer site for information security professionals. It only takes a minute to sign up.Sign up to join this community
I'm not sure exactly what type of attack you are referencing but consider this...if an attacker controls your router what is to stop them from making any arbitrary change to unencrypted data? The packets pass through the router and the router could (if desired) make any change to the packet that the attacker desires (assuming he has taught the router how to make the changes properly). If the data is encrypted end to end this becomes much more difficult to pull off (still possible through a more complex attack path).