Hiding content from source code (Firefox)

 
Post new topic   Reply to topic    Aprelium Forum Index -> Off Topic Discussions
View previous topic :: View next topic  
Author Message
cmxflash
-


Joined: 11 Dec 2004
Posts: 872

PostPosted: Thu Jan 18, 2007 7:04 pm    Post subject: Hiding content from source code (Firefox) Reply with quote

Today I discovered that it is possible to execute javascript in Firefox (2.0.0.1) by using the refresh header.

This could be used in many ways, like hiding content from the source code.

Code:
<?php
if (eregi("firefox", $_SERVER['HTTP_USER_AGENT'])) {
   header("Refresh: 0; Javascript: if (confirm('Do you belive I can hide this message from the page source code?')) { alert('Damn right'); } else { alert('You\\'re wrong.'); }");
}
?><html>
<head>
<title>Test</title>
</head>
<body>
<p>Kebab ftw</p>
</body>
</html>


However, using document.write seems to make Firefox load the page forever, even if it is fully loaded. Not sure if this could be a way to securly load a document using AJAX and hiding the source URL from the user.

Even if this isn't really useful, it is pretty cool to show your buddies how you are able to run Javascript that isn't in the source code.
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Fri Jan 19, 2007 1:00 am    Post subject: Re: Hiding content from source code (Firefox) Reply with quote

cmxflash,

That's a very nice trick. Thanks for sharing it with us.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
cmxflash
-


Joined: 11 Dec 2004
Posts: 872

PostPosted: Sun Feb 25, 2007 1:41 pm    Post subject: Reply with quote

Just found another interesting way of hiding the source code in Firefox, using onUnload. Not sure if this can be used for cross-side scripting, since Firefox belives it's on another page when redirected back.

Code:
<?php
if (isset($_GET['n'])) {
   die("Source code hidden.\n\nGo away");
}

if (!isset($_GET['do'])) {
   header("refresh: 0; url=index.php?n");
}
?>

<html>
<head>
<title>Testing page</title>
</head>
<body onunload="location.href='index.php?do'">
<h1>Schalla!</h1><p>Hidden source code</p>
</body>
</html>
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Mon Feb 26, 2007 3:11 pm    Post subject: Reply with quote

cmxflash,

Interesting. Does other browsers suffer/have the same way of doing things?
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
cmxflash
-


Joined: 11 Dec 2004
Posts: 872

PostPosted: Mon Feb 26, 2007 3:57 pm    Post subject: Reply with quote

aprelium wrote:
Does other browsers suffer/have the same way of doing things?


The script prevents both IE and Firefox from leaving the page since the javascript is executed after the user has entered the new URL. Only Firefox (and probably other browsers based on the same engine) hides the source code. I tried to steal session cookies from another web site using this method, however I was unable to do so.
Back to top View user's profile Send private message
puertoblack2003
-


Joined: 08 Oct 2006
Posts: 87

PostPosted: Mon May 28, 2007 2:32 pm    Post subject: Reply with quote

how do this work do i created a index.html and put it in the folder directory???
Back to top View user's profile Send private message
hc2995
-


Joined: 07 Aug 2006
Posts: 644
Location: Maryland, USA

PostPosted: Mon May 28, 2007 3:25 pm    Post subject: Reply with quote

no, this is a PHP script, you need PHP to be installed and functioning
_________________
Where have i been? School got heck-tick, had to move half way around the state, then back... and then i had to change jobs, so iv been away for a while :P
Back to top View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> Off Topic Discussions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group