Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it safe to allow users to edit css?

Tags:

css

security

I have a web application where I would like to allow end users to customise the look of the web site by uploading their own css file.

Are there any security issues with this? I can't see anything obvious but thought I'd ask in case there was anything I'd missed.

like image 786
jcoder Avatar asked Sep 21 '09 09:09

jcoder


People also ask

Is User CSS safe?

No, it's not safe.

Can you edit the CSS?

Edit the CSS fileOnce you have created or opened an existing CSS file, make your edits in the code editor. In addition to standard CSS, the code editor supports HubL variables and macros to make maintaining your CSS easier.


1 Answers

Javascript can be executed in CSS, you have to make sure that you are using some filtering.

I have also seen incidents where someone has covered the entire page on a microsoft controlled site with a transparent pixel, linking to a malicious site. Clicking anywhere triggered the attackers site to appear.

This could however be safe if the user only sees his or her own CSS, and they would have no way of someone else viewing what they have done. Otherwise some sort of whitelist or markdown would work.

like image 63
Sam152 Avatar answered Oct 26 '22 17:10

Sam152