Zoklet.net

Go Back   Zoklet.net > Technology > Network Security & Hacking

Reply
 
Thread Tools
  #1  
Old 01-19-2009, 04:05 PM
oddballz194 oddballz194 is offline
Member
 
Join Date: Jan 2009
Location: Right next to that other place
Thanks: 24
Thanked 34 Times in 29 Posts
Default Forcing the use of HTTPS on web sites (from Totse)

I found a copy of this on a website, even though it's not in Google's cache. The formatting WILL need fixed, because it was totally trashed by the site I got this from. However, to me the article is worth it -- and will be more valuable if Zok sets up a signing key on Zoklet. I have tried to make it closer to the original format, but especially towards the bottom I know I've failed miserably. If anyone -- especially Prometheum -- finds problems with this copy, please alert me so the article can be fixed.

And on that note, I submit the article.

Posted by Prometheum:

A Method for Enhancing Security through HTTPS on Popular Internet Sites - Community
Abstract: I present a method for redirecting all plaintext traffic for browsing Totse via HTTP to HTTPS, a version of HTTP which uses SSL encryption.

This work can be expanded to allow arbitrary HTTP/HTTPS hybrid sites to be coerced into using HTTPS.

1: Introduction I first began using https to browse Totse a long time ago for reasons I have since long forgotten.

Since then, the only other user I have known to have used HTTPS exclusively is our venerable moderator oddballz, with the possible exception of one user who asked about HTTPS after Jeff Hunter bumped a news item on the front page related to Totse's use of HTTPS.

However, I have frequently been linked to totse pages presented in HTTP by members in other channels of communication.

While it is easy for me to remember to change to HTTPS (as I have different Totse themes on each one), others might not be so lucky.

Using HTTPS has a number of benefits, including bypassing weak censorship measures, providing anonymity of content, and providing security of login credentials in hostile networks (such as unsecured or wep-encrypted wireless networks or school/universitly/workplace networks).

This guide begins with information on installing ForcedHTTPS, continues with a description of the ForceHTTPS configuration system, details an implementation of ForceHTTPS rules for Totse, and concludes with implications and acknowledgements.

2.1: Installing ForcedHTTPS ForcedHTTPS is implemented as an extension for the popular Free Software browser Mozilla Firefox.

If you do not have Firefox installed, you will need to install it before going on.

If you are using a Debian-based system with AptURL installed, simply click here.

If not, refer to your systems documentation as to how to install Firefox. Once Firefox is installed, navigate to the ForceHTTPS project page and click the button labeled "ForcedHTTPS Installer".

This will install the addon into Firefox.

Restart Firefox afterwards to load the extension.

2.2: About ForceHTTPS ForceHTTPS defends against threats in two ways: rewriting URL's to select sites to use https instead of http, and by protecting cookies from those sites against access on non-secure sites.

For further information about ForceHTTPS, refer to the paper ForceHTTPS: Protecting High-Security Web Sites from Network Attacks, by Colin Jackson and Adam Barth.

2.3: About HTTP vs. HTTPS The Internet was originally designed as a small network between trusted peers.

As such, many protocols which could communicate sensitive information (ftp, remote login, and http) were left in "plaintext", or unobfuscated forms.

However, the internet quickly exploded out of ARPA's basement and began proliferating.

Now, internet users face phishing, cross-site request forgeries and cross-site scripting exploits, and hostile networks.

HTTP, as a "plaintext" protocol, is woefully inadequate for these situations, as any data sent over a plaintext http connection can be trivially read by any third party.

HTTPS was developed to grant end-to-end encryption for HTTP users, an absolute necessity for privacy or e-commerce.

To use an analogy common to email, HTTP is like a postcard, while HTTPS is like a letter in an envelope.

Nobody carrying the envelop can see what is inside it.

Only the users on the ends of the stream are capable of obtaining the original plaintext.

3: Configuring ForcedHTTPS for Arbitrary Sites

3.1: An Overview of ForceHTTPS Configuration While ForceHTTPS is indeed user-configurable, it does not implement a Preferences menu in the Addons Manager window.

We will need to head to about:config and enter "forcehttps" as a filter in order to view only forcehttps-related keys. You will see three main groups here, in the classes forcehttps.blocking.rules, forcehttps.rewriting.rules, and forcehttps.stripcookies.rules.

The keys are then in their own subclasses of these classes, with the name of the base class name being a regular expression denoting the site to protect.

For instance, to protect example.com from un-encrypted access, one would add keys of these names:
Code:
forcehttps.blocking.rules.^example[.]com$ forcehttps.rewriting.rules.^http://example[.]com$ forcehttps.stripcookies.rules.^example[.]com$
For those unfamiliar with regular expressions, the '^' character denotes the beginning of a line, and the '$' character denotes the end of a line.

Brackets ("[", "]") are added around periods in the final class name in order to explicitly declare them as the character ".", and not the special regular expression character ".".

For further information on regexes, see wikipedia. These keys are presented in the order which they will appear on the page.

Keys 1 and 3 are of type "boolean" and should be set to "true" in order for ForceHTTPS to protect the host.

Key 2, however, is different. The second key is of type "string", and denotes what the URL should be transformed to upon a successful match.

The use of regular expressions in the class basename allows for elements of the original URL to be accessed through regular expression memory variables, which will be discussed later.

The value of key 2 should be the secure URL.

In a simple case such as this, the value would be:
Code:
https://example.com
4: Implementations of ForceHTTPS This section contains instructions and analysis pertaining to specific applications of ForceHTTPS.

The sites discussed will be totse.com and Wikipedia, as they provide examples of both simple and complex applications of ForceHTTPS.

4.1: Securing Totse with ForceHTTPS As discussed previously, securing a site with ForceHTTPS requires three keys to be set.

The names of the keys in Totse's case are:
Code:
forcehttps.blocking.rules.^www[.]totse[.]com$ forcehttps.rewriting.rules.^http://www[.]totse[.]com/ forcehttps.stripcookies.rules.^www[.]totse[.]com$
The types for keys 1 and 3 should be "boolean", and their values "true".

The type of the second key should be "string", and its value should be:
Code:
https://www.totse.com/
The configuration will be active immediately.

You can test it by loading any http totse page.

As Totse uses a self-signed SSL certificate, you will have to "confirm" that the certificate is valid.

The proper MD5 and SHA1 fingerprints for Totse's certificate are located here.

4.2: Applying ForceHTTPS to Wikipedia Wikipedia is another site for which it makes very good sense to use HTTPS.

Wikipedia content has been censored even in first-world "democratic" countries such as the United Kingdom, and the knowledge on Wikipedia could be deemed "subversive" or "terrorist" by entities.

Using HTTPS to access Wikipedia is very prudent, but unlike Totse, Wikipedia does not offer HTTP and HTTPS side-by-side.

Instead, it uses a separate secure host located at secure.wikimedia.org.

This section outlines how to configure ForceHTTPS to convert HTTP wikipedia URLs to secure HTTPS URLs.

Just because we can, we will block unprotected access to several popular Wikimedia sites: wikibooks, wikinews, wikiversity, wikiQuote: , and wiktionary. The most complex element of this configuration is the URL transformation.

We must rewrite a URL in the form of http://en.wikipedia.org/wiki/Totse to a URL in the form of http://en.wikipedia.org/wiki/Totse .

To simplify this, let's break the HTTP URL into component parts: Code: http://<language_code>.<wiki>.org/wiki/<Article_name> The corresponding URL for the secure server is: Code: https://secure.wikimedia.org/<wiki>/<language_code>/<Article_name> This calls for an application of regex variables.

Regex variables are created when a part of a regex is enclosed in parens, and are accessed by $1, $2, ..., $n in order of appearance.

Therefore, our key #2 for ForceHTTPS wikipedia is: Code: forcehttps.rewriting.rules.

^http://(.{2})[.]wik(tionary|ipedia|inews||iQuoteibooks|iversity)[.]org/wiki/(.+)($|/) with a value of Code: forcehttps.rewriting.rules.

^http://(.{2})[.]wik(tionary|ipedia|inews||iQuoteibooks|iversity)[.]org/wiki/(.+)($|/) (newlines added for cosmetic reasons) As you can see, The other two keys are simpler.

They are: Code: forcehttps.blocking.rules.(^|[.])wik(tionary|ipedia|inews||iQuoteibooks|iversity)[.]org$ forcehttps.stripcookies.rules.(^|[.])wik(tionary|ipedia|inews||iQuoteibooks|iversity)[.]org$ As always, they are booleans, set to "true". Visiting arbitrary pages on these Wikimedia projects will now redirect you to the secure URL. 5: Implications and Acknowledgements 5.1: Implications As has been stated, using https allows for end-to-end security and protection of content.

HTTPS can be used to circumvent poorly-configured blocklists and to circumvent dynamic content-inspection filtering systems.

While an adversary can see which site a user is connecting to, they are unable to determine what content on the site the user is accessing. 5.2: Acknowledgements The author would like to thank the authors of ForceHTTPS, Colin Jackson and Adam Barth.

The author would also like to thank oddballz, for always using https and saying so any time the author linked a thread using https, and Richard M.

Stallman for making freedom possible in the first place.
Reply With Quote
  #2  
Old 01-19-2009, 04:07 PM
oddballz194 oddballz194 is offline
Member
 
Join Date: Jan 2009
Location: Right next to that other place
Thanks: 24
Thanked 34 Times in 29 Posts
Default Re: Forcing the use of HTTPS on web sites (from Totse)

oddballz194 posted:

Just a small comment -- I had a hard time getting Prometheum's setup for Totse to work, and I tried a dozen things before I finally figured out what the problem was.

When I copied and pasted this line:
Code:
 forcehttps.rewriting.rules.^http://www[.]totse[.]com/
into Firefox, I had included an extra space after the last "/" character.

Yes, it's a dumb mistake to make, but when I redid it without the space it worked. Also, if you make a mistake while making the setting keys, you can right-click on them and select Reset.

When you close Firefox it purges those keys unless they have values in the system-wide configuration for the browser (in which case it keeps the system-wide versions in favor of yours).
Reply With Quote
  #3  
Old 01-19-2009, 04:08 PM
oddballz194 oddballz194 is offline
Member
 
Join Date: Jan 2009
Location: Right next to that other place
Thanks: 24
Thanked 34 Times in 29 Posts
Default Re: Forcing the use of HTTPS on web sites (from Totse)

Prometheum posted:
Quote:
Originally Posted by oddballz194
Just a small comment -- I had a hard time getting Prometheum's setup for Totse to work, and I tried a dozen things before I finally figured out what the problem was.

When I copied and pasted this line: into Firefox, I had included an extra space after the last "/" character.

Yes, it's a dumb mistake to make, but when I redid it without the space it worked. Also, if you make a mistake while making the setting keys, you can right-click on them and select Reset.

When you close Firefox it purges those keys unless they have values in the system-wide configuration for the browser (in which case it keeps the system-wide versions in favor of yours).
Oh, that's a good trick.

When I messed up I just opened prefs.js and removed the lines.

Wish I had known of this earlier (that wikipedia one took ages to make).
Reply With Quote
  #4  
Old 01-19-2009, 04:11 PM
oddballz194 oddballz194 is offline
Member
 
Join Date: Jan 2009
Location: Right next to that other place
Thanks: 24
Thanked 34 Times in 29 Posts
Default Re: Forcing the use of HTTPS on web sites (from Totse)

There are three other posts, but the cache I used to find this doesn't include the usernames.

So here are the posts, without attribution. If you know who said what, please let me know.

Quote:
Originally Posted by Mutant Funk Drink
Nice post, Prometheum.
Quote:
Very nice work my friend.

++e-penz0r.
Quote:
Actually i do prefer Https, but due to narrow band Internet some times pages just won't load.

And thanks to my country i don't really have to worry about censorship issues or privacy issues as well, if the

Last edited by oddballz194; 01-22-2009 at 03:35 PM.
Reply With Quote
  #5  
Old 01-22-2009, 06:08 AM
Mutant Funk Drink's Avatar
Mutant Funk Drink Mutant Funk Drink is offline
Grand Duke
 
Join Date: Jan 2009
Thanks: 2,656
Thanked 1,563 Times in 1,003 Posts
Default Re: Forcing the use of HTTPS on web sites (from Totse)

I was the one who made the first quote.
Reply With Quote
  #6  
Old 01-22-2009, 03:36 PM
oddballz194 oddballz194 is offline
Member
 
Join Date: Jan 2009
Location: Right next to that other place
Thanks: 24
Thanked 34 Times in 29 Posts
Default Re: Forcing the use of HTTPS on web sites (from Totse)

Quote:
Originally Posted by Mutant Funk Drink View Post
I was the one who made the first quote.
Thanks. I edited the post to indicate that.

I think the last one is Dfgremnantsunleashed, but I'm not sure.
Reply With Quote
  #7  
Old 01-31-2009, 07:38 PM
McFly McFly is offline
New Arrival
 
Join Date: Jan 2009
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Forcing the use of HTTPS on web sites (from Totse)

NoScript will do this also.
Reply With Quote
  #8  
Old 01-31-2009, 10:23 PM
Prometheum Prometheum is offline
Member
 
Join Date: Jan 2009
Location: 01
Thanks: 4
Thanked 5 Times in 4 Posts
Send a message via AIM to Prometheum Send a message via MSN to Prometheum
Default Re: Forcing the use of HTTPS on web sites (from Totse)

Quote:
Originally Posted by McFly View Post
NoScript will do this also.
No it won't. I use noscript. Explain yourself.
Reply With Quote
  #9  
Old 01-31-2009, 11:08 PM
oddballz194 oddballz194 is offline
Member
 
Join Date: Jan 2009
Location: Right next to that other place
Thanks: 24
Thanked 34 Times in 29 Posts
Re: Forcing the use of HTTPS on web sites (from Totse)

Quote:
Originally Posted by Prometheum View Post
No it won't. I use noscript. Explain yourself.
Actually, I looked at my copy of NoScript after he posted that. If you right-click on the S icon in the status bar at the bottom of the Forefox window (the NoScript icon), then select Options, then Advanced, then HTTPS. It has a section "Force the following sites to use secure (HTTPS) connections:". So it appears NoScript can do this, although I suspect it's a VERY recent addition.
Reply With Quote
  #10  
Old 01-31-2009, 11:47 PM
Prometheum Prometheum is offline
Member
 
Join Date: Jan 2009
Location: 01
Thanks: 4
Thanked 5 Times in 4 Posts
Send a message via AIM to Prometheum Send a message via MSN to Prometheum
Default Re: Forcing the use of HTTPS on web sites (from Totse)

Quote:
Originally Posted by oddballz194 View Post
Actually, I looked at my copy of NoScript after he posted that. If you right-click on the S icon in the status bar at the bottom of the Forefox window (the NoScript icon), then select Options, then Advanced, then HTTPS. It has a section "Force the following sites to use secure (HTTPS) connections:". So it appears NoScript can do this, although I suspect it's a VERY recent addition.
0.0

Whoa, that's cool. They should have that more prominently displayed.
Reply With Quote
  #11  
Old 02-01-2009, 02:25 AM
McFly McFly is offline
New Arrival
 
Join Date: Jan 2009
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Forcing the use of HTTPS on web sites (from Totse)

Quote:
Originally Posted by oddballz194 View Post
So it appears NoScript can do this, although I suspect it's a VERY recent addition.
It's been there for at least a few months. But yeah, they didn't really advertise it as a new feature.

Last edited by McFly; 02-01-2009 at 02:36 AM.
Reply With Quote
  #12  
Old 03-06-2009, 06:25 PM
The Cheshire Cat The Cheshire Cat is offline
AFK
 
Join Date: Jan 2009
Location: Everywhere
Thanks: 463
Thanked 925 Times in 580 Posts
Send a message via MSN to The Cheshire Cat
Arrow Re: Forcing the use of HTTPS on web sites (from Totse)

For those of you that run your own websites this should be implemented.

Code:
RewriteCond %{HTTP_HOST} ^http://website.com$ [NC]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ http://website.com/$1 [L,R=301]

Just drop it in your .htaccess file and you're good to go.
__________________
Quote:
Originally Posted by -SpectraL View Post
Some people just like to be argumentative about stuff nobody should really give a fuck about.
Reply With Quote
  #13  
Old 06-24-2010, 02:42 PM
KingOfTheTrolls KingOfTheTrolls is offline
Member
 
Join Date: Jun 2010
Thanks: 1
Thanked 2 Times in 2 Posts
Default Re: Forcing the use of HTTPS on web sites (from Totse)

Fantastic guide, I've been wondering about this for a while. Thanks!
Reply With Quote
  #14  
Old 07-24-2010, 02:10 AM
padam padam is offline
Member
 
Join Date: Dec 2009
Thanks: 0
Thanked 4 Times in 4 Posts
Default Re: Forcing the use of HTTPS on web sites (from Totse)

I'm assuming most people already know about this, but for the ones that don't:

https://encrypted.google.com/
Reply With Quote
  #15  
Old 12-15-2011, 07:25 AM
STD's Avatar
STD STD is offline
Duke
 
Join Date: Aug 2011
Location: NSFW, Australia
Thanks: 1,362
Thanked 604 Times in 454 Posts
Default Re: Forcing the use of HTTPS on web sites (from Totse)

The HTTPSEverywhere addon for Firefox

One you add a custom rule for Zoklet it works great

Recommended for all
__________________
syphilis.stdx [at] gmail [dot] com
"Wow, STD has really gone off the deep end. He's like a one-man, polydrug, chronic toxicity study"
Reply With Quote
  #16  
Old 12-17-2011, 01:22 AM
LiquidIce LiquidIce is offline
Duke
 
Join Date: Jan 2009
Location: New York City/Jötunheimr
Thanks: 392
Thanked 426 Times in 323 Posts
Default Re: Forcing the use of HTTPS on web sites (from Totse)

I did this using noscript too. Handy function, I'll admit.
__________________
This is one distrusting smiley.
Equality is mediocrity.
Reply With Quote
  #17  
Old 12-17-2011, 05:57 AM
Mutant Funk Drink's Avatar
Mutant Funk Drink Mutant Funk Drink is offline
Grand Duke
 
Join Date: Jan 2009
Thanks: 2,656
Thanked 1,563 Times in 1,003 Posts
Default Re: Forcing the use of HTTPS on web sites (from Totse)

I wonder what became of Prometheum? I remember he as kind of a dick, but a well intentioned dick at that. And he brought up a lot of great points.
__________________
Aristophanes once wrote, roughly translated; "Youth ages, immaturity is outgrown, ignorance can be educated, and drunkenness sobered, but STUPID lasts forever."

Give a man a fish, he'll eat for a day. Give a man religion, and he'll starve praying for a fish.
Reply With Quote
Reply

Bookmarks

Tags
forcing, https, sites, totse, web

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:59 PM.


Hot Topics
On IRC
Users: 4
Messages/minute: 0
Topic: "http://www.zoklet.net/..."
Users: 23
Messages/minute: 0
Topic: "ask ibm why atlantis is real"
Users: 10
Messages/minute: 0
Topic: "So wie ich die sache sehe ist die intelligenz bereits ausgerot..."
Advertisements
Your ad could go right HERE! Contact us!

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.