I am a bit confused with the possible security risks with tracking cookies.
From what I have read, if i am on a website and they have ads from a service like doubleclick, doubleclick will place a cookie on my computer. It assigns me a unique id and then makes a note that i was on website example.com. When I visit another site that uses doubbleclick, lets say example2.com, a script runs and sees that i have a cookie from doubbleclick and then doubbleclick checks what website I was on in the past. It then displays relevant ads and content on example2.com
My questions are:
1st, How does it work?
2nd, if I accidentally click on a malicious website that has doubbleclick ads, can that website get a copy of all of the data that doubbleclick has on me, and sell all of my browsing history to a marketing company?
Or does doubbleclick keep the web history it has on me to itself and just give the website relevant ads to display?