![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
We're considering allowing our users to host their own stylesheet, and just pass in its URL as a CGI parameter. Something like this: .../cgi-bin/script?stylesheet=http://example.com/style.css with corresponding code like this in the HTML page template: link href="$STYLESHEET" rel="stylesheet" type="text/css" / Of course, we have no control over what gets passed in to the stylesheet parameter, so we have to be prepared for the possibility that a malicious person sets it to something nasty. |
#3
| |||
| |||
|
|
I only have a rough knowledge of the full power of cascading stylesheets. Are there any other security concerns I should be thinking about? In particular, is there any way to embed client-executed code (like JavaScript) into a stylesheet, implement some other kind of cross-site scripting attack, or otherwise cause the stylesheet to do anything besides alter the display of the page? |
#4
| ||||
| ||||
|
|
We will escape $stylesheet so it can only contain letters, numbers, underscore, dash, slashes, colons, and dots (to avoid cross-site scripting), ensure it starts with "http://" or "https://" and contains no port specification after the host |
|
and require the filename to end with ".css" (to make it more difficult to cause a script to run). |
|
Something like this: /^https?:\/\/[\w.-]+\/[\w\/:.-]+\.css$/ |
|
I only have a rough knowledge of the full power of cascading stylesheets. Are there any other security concerns I should be thinking about? |
#5
| |||
| |||
|
|
Hello, We've got a Web-based application written in Perl that is designed to integrate as a frame into many different Web sites. We currently have several stylesheets available to allow the user to match the look and feel to their existing Web site. We're considering allowing our users to host their own stylesheet, and just pass in its URL as a CGI parameter. Something like this: |
|
Of course, we have no control over what gets passed in to the stylesheet parameter, so we have to be prepared for the possibility that a malicious person sets it to something nasty. |
#6
| |||
| |||
|
|
In particular, is there any way to embed client-executed code (like JavaScript) into a stylesheet, |
#7
| |||
| |||
|
|
Scott W Gifford wrote: In a file served with a text/css media type? Yes. http://archivist.incutio.com/viewlist/css-discuss/44263 has a simple example, but expression lets any JavaScript be executed in Internet Explorer (and can call ActiveX controls etc). |
#8
| |||
| |||
|
|
We're considering allowing our users to host their own stylesheet, |
#9
| |||
| |||
|
|
Any other risks I may not have considered? |
#10
| ||||
| ||||
|
|
In comp.security.misc Scott W Gifford <gifford (AT) umich (DOT) edu> wrote: We will escape $stylesheet so it can only contain letters, numbers, underscore, dash, slashes, colons, and dots (to avoid cross-site scripting), ensure it starts with "http://" or "https://" and contains no port specification after the host The latter is a drawback. |
|
and require the filename to end with ".css" (to make it more difficult to cause a script to run). This is unneccessary. |
|
Something like this: /^https?:\/\/[\w.-]+\/[\w\/:.-]+\.css$/ Why not implementing RFC1738, 3.3 exactly? |
|
I only have a rough knowledge of the full power of cascading stylesheets. Are there any other security concerns I should be thinking about? With :before and :after there may be risks by inserting local scripting code. |
![]() |
| Thread Tools | |
| Display Modes | |
| |