I enjoy using the Stylus browser add-on, which allows users to install CSS style packages as desired.
I recently came across an intriguing video by Mike Pound from Computerphile about cookie stealing: https://www.youtube.com/watch?v=T1QEs3mdJoc
CSS has the ability to apply background images to elements that do not have one initially. I even wrote a code snippet that removes a background image if there is one present.
In the video, Dr. Pound demonstrates how an image URL can execute PHP code to steal session cookies. He mentions attempting to trick the browser into sending the cookie at 11:19.
This leads me to wonder: Can user-defined styles, through dynamically loaded CSS rules, be utilized as a vector for stealing session cookies by manipulating the background of certain elements with URLs containing PHP code for stealing sessions?
If not, what prevents this security breach? (Could it be related to Content Security Policy?)
And if so, is there a way to prevent this without disabling add-ons that inject dynamic CSS?
-- I plan on conducting some experiments myself soon and wanted to open up the discussion within the community in a theoretical manner.
Feel free to downvote if you think my question is foolish, the button is right over there.