🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.privacy.anon-server
Article #18591

Safeweb eval() potential hole solution (was: SafeWeb "Paranoid" Sanitization kills JS bugs)

#18591
From: Thomas Shaddack
Date: Tue, 08 May 2001 22:52
55 lines
3252 bytes
Dave Howe <Spam.Blocker@bigfoot.com> wrote in 
<b4feft88h4ochujrvbvr4cii6guno7mgoh@4ax.com>:

<snip>
>I must admit to not having learned JS to this depth - is it really so
>difficult to rewrite Eval(string) as Eval(Safeweb.checksafe(string))?
>(note this not valid syntax, and I know it - it is just to give feel
>for the required process) or would that be too slow for most uses? I
>have the feeling it would be (imagining a site calculating a clock
>with eval *shudder*)
>how about a java library? could you call a local java app to
>sanity-check strings for you? even if this only caught events after
>the fact (got a copy of the string after it had been passed to eval,
>and popped up a "oops, site has done $NAUGHTYTHING; click here of if
>you wish to inform Safeweb of the following information:
>website url
>string"

Not necessary, not necessary!

It's possible to re-set eval() function pointer to another function that 
gets executed instead each time eval() is called.

Example:
<script language=javascript>
eval=alert;
eval("document.write('This is a test');");
</script>

Try this and you will see what I mean. I just tried it (MSIE5) and it 
works. :)

Disclaimer: I am not familiar with SafeWeb's javascript libraries so I 
don't know what functions are available and what further "magic" is 
possible.

The implementation could look this way:

function safeeval(s)
{randomstringeval(Safeweb.checksafe(string));}
randomstringeval=eval;  //Prevent recursion
eval=safeeval;

The "randomstring" part would have to be replaced by a random sequence of 
characters, unique for each page served; this will prevent eventual attack 
via direct call of original renamed unsecured eval().

This script has to be placed at the very beginning of the page; I suppose 
this part is trivial for SafeWeb's processing scripts.

Voila, eval() hole is closed :)

Calling for peer review; if I am wrong in anything, please correct me.

        Shaddack, the Mad Scientist
Technical Details
Message-ID: <Xns909C2AB0CEF1shaddacktypecom@195.250.128.40>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.mbox.zip!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!212.74.64.35!colt.net!nntp1.aeq.teleglobe.net!teleglobe.net!news.vol.cz!not-for-mail
References: <fe251fd9420f9a91080c169f69999f42@mix2.hyperreal.pl> <mon8ft8ruhpkga4ssi50se6tk66q74838h@4ax.com> <7xn18rt0lz.fsf@ruckus.brouhaha.com> <3af72cfa.25210490@news.pacbell.net> <b4feft88h4ochujrvbvr4cii6guno7mgoh@4ax.com>

Show Full Headers
Complete Article Headers
Message-ID: <Xns909C2AB0CEF1shaddacktypecom@195.250.128.40>
Subject: Safeweb eval() potential hole solution (was: SafeWeb "Paranoid" Sanitization kills JS bugs)
Date: Tue, 08 May 2001 22:52:57 +0000
From: NOSPAMshaddack@type2.com (Thomas Shaddack)
References: <fe251fd9420f9a91080c169f69999f42@mix2.hyperreal.pl> <mon8ft8ruhpkga4ssi50se6tk66q74838h@4ax.com> <7xn18rt0lz.fsf@ruckus.brouhaha.com> <3af72cfa.25210490@news.pacbell.net> <b4feft88h4ochujrvbvr4cii6guno7mgoh@4ax.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.mbox.zip!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!212.74.64.35!colt.net!nntp1.aeq.teleglobe.net!teleglobe.net!news.vol.cz!not-for-mail
Newsgroups: alt.privacy,alt.privacy.anon-server,alt.security.pgp
Organization: New Wave Microtechnology
Lines: 55
NNTP-Posting-Host: dateld-231.dialup.vol.cz
X-Trace: news.vol.cz 989362377 50307 212.20.106.231 (8 May 2001 22:52:57 GMT)
X-Complaints-To: abuse@vol.cz
NNTP-Posting-Date: Tue, 8 May 2001 22:52:57 +0000 (UTC)
User-Agent: Xnews/M3