hack0r.net


UTF-7 Stuff

Posted in Webapp Security by n00k on the March 7th, 2007

A few days ago I got a link from Martin Johns (this) and started playing around with this.

A scenario for this is: you got a page where everything between < and > is filtered out. It seems to forbid the inclusion of <script> blocks. But here is the clue. If the page does not define a charset, neither in the header, nor by a meta tag, we may load the page within an iframe on a page which charset is set to UTF-7 and this way having not < or >, but +ADw- and +AD4- circumvents the filter.

I got some code working, which exploits this here. You may want to see the page here, that will be loaded into the iframe, before you look at the link, since firefox saves the overwritten charset for that page and will view the content with the charset set to UTF-7 and this way executing the javascript. To reset it just clear your browser chache.

Since I do not have a second domain at the moment and could not find a page, which does not set the charset, I could not test what happens if an alien domain is loaded inside the iframe.

While looking for a page, that does not define a charset, I found something else which seems like a fixed issue. On pages where the charset is not defined in the header, but in a meta tag, there should be no charset defined on pages that are generated by the webserver itself. But too bad, someone else must have found that before, because in 404 error pages, which at least generated by Apache show the string of the wanted page, now magically have a charset defined in the header. If you got another idea how a webserver may be tricked into generating a page without a charset, I would love to know.

Popularity: unranked [?]

2 Responses to 'UTF-7 Stuff'

Subscribe to comments with RSS or TrackBack to 'UTF-7 Stuff'.

  1. n00k said,

    on March 12th, 2007 at 3:38 am

    Okay, now that I am the proud owner of hack0r.net I could test this what happens, if the page inside the iframe is from a different domain. You can see it here.

    I tested this on Firefox 2.0.0.1, which does execute the javascript code and Firefox 2.0.0.2, which has fixed this issue.

  2. n00k said,

    on March 12th, 2007 at 10:16 pm

    I just have tested this issue on IE 7. It is vulnerable even to the cross domain issue.
    One thing IE does better than FF in this topic is, that it does not save the charset of the page loaded inside the iframe.

Leave a Reply