talk page 2 - Dave's Blog

Search
My timeline on Mastodon

Stripe CTF - Level 5

2012 Sep 11, 5:00

Level 5 of the Stripe CTF revolved around a design issue in an OpenID like protocol.

Code

    def authenticated?(body)
body =~ /[^\w]AUTHENTICATED[^\w]*$/
end

...

if authenticated?(body)
session[:auth_user] = username
session[:auth_host] = host
return "Remote server responded with: #{body}." \
" Authenticated as #{username}@#{host}!"

Issue

This level is an implementation of a federated identity protocol. You give it an endpoint URI and a username and password, it posts the username and password to the endpoint URI, and if the response is 'AUTHENTICATED' then access is allowed. It is easy to be authenticated on a server you control, but this level requires you to authenticate from the server running the level. This level only talks to stripe CTF servers so the first step is to upload a document to the level 2 server containing the text 'AUTHENTICATED' and we can now authenticate on a level 2 server. Notice that the level 5 server will dump out the content of the endpoint URI and that the regexp it uses to detect the text 'AUTHENTICATED' can match on that dump. Accordingly I uploaded an authenticated file to

https://level02-2.stripe-ctf.com/user-ajvivlehdt/uploads/authenticated
Using that as my endpoint URI means authenticating as level 2. I can then choose the following endpoint URI to authenticate as level 5.
https://level05-1.stripe-ctf.com/user-qtoyekwrod/?pingback=https%3A%2F%2Flevel02-2.stripe-ctf.com%2Fuser-ajvivlehdt%2Fuploads%2Fauthenticated&username=a&password=a
Navigating to that URI results in the level 5 server telling me I'm authenticated as level 2 and lists the text of the level 2 file 'AUTHENTICATED'. Feeding this back into the level 5 server as my endpoint URI means level 5 seeing 'AUTHENTICATED' coming back from a level 5 URI.

Notes

I didn't see any particular code review red flags, really the issue here is that the regular expression testing for 'AUTHENTICATED' is too permisive and the protocol itself doesn't do enough. The protocol requires only a set piece of common literal text to be returned which makes it easy for a server to accidentally fall into authenticating. Having the endpoint URI have to return variable text based on the input would make it much harder for a server to accidentally authenticate.

PermalinkCommentsinternet openid security stripe-ctf technical web

Funny People: Steve Heinrich, You Don’t Know Jack head writer | Interview | The Gameological Society

2012 Jul 1, 3:38

A veteran of the satirical trivia game series since its first heyday in the 1990s, Heinrich talks about Jack’s writing process, its long hiatus, and that short-lived live-action TV version.

PermalinkCommentsgame interview video-game you-dont-know-jack ydkj

“Fuck You, Pay Me” is a talk on contracts, payments,...

2012 Jun 25, 2:06


Fuck You, Pay Me” is a talk on contracts, payments, etc. for free-lance designers.

PermalinkCommentsbusiness web-desgin video technical

Microsoft Research make breakthrough in audio speech recognition (technet.com)

2012 Jun 22, 2:33

MAVIS indexes audio and video so you can do text search over the contents. For example search for ‘metro’ in all of the BUILD conference talks.

PermalinkCommentstechnical voice-recognition microsoft research mavis search

Clippy.JS - Add Clippy and friends to any website (smore.com)

2012 May 29, 6:15

A great JS API to add Clippy or other agents to your website!  Make them talk, dance, gesture, etc

PermalinkCommentshumor microsoft js javascript web

Microsoft talks Windows 8 SKUs: Windows 8, Windows 8 Pro, and "Windows RT" for ARM

2012 Apr 16, 2:11

Windows RT is the name of the Win8 ARM SKU? That’s funny because its also the Windows Runtime: http://msdn.microsoft.com/en-us/library/windows/apps/br211377

PermalinkCommentstechnical win8

“On The Verge is ready for a lot of things, but we clearly...

2012 Apr 2, 8:31


“On The Verge is ready for a lot of things, but we clearly weren’t ready for renowned astrophysicist Dr. Neil deGrasse Tyson, who stopped by to talk space exploration, life as a meme, and why he carries a slightly-illegal laser with him at all times.”

PermalinkCommentsinternet meme humor video neil-degrasse-tyson

Rob Reid: The $8 billion iPod.  5min TED talk on copyright math

2012 Mar 15, 6:25
an>
PermalinkCommentshumor video ipod music mpaa riaa ted copyright

Star Trek: TNG Season 8 illustration has us longing for more [Star Trek]

2012 Mar 5, 3:17

Fictional plot summaries of TNG S8 episodes.    Like:

  • Q’s back: he’s wearing scuba gear and needs Picard’s help dumping his girlfriend. Barclay accidentally locks himself outside the ship.
  • Geordie and Data nurse a space bird back to health, and are sad when they have to release it. Picard is trapped in a turbolift with a baby.
  • Starfleet sends a cantankerous admiral to boss around Picard during delicate peace talks. Data seems to have mastered bragging.
  • Riker’s ex-girlfriend arrives and dies, leaving behind a pile of glowing dust and a mystery. Picard is trapped on a turbolift with a horse.
  • A planet of suspicious docents abduct Riker for their museum of amazing men. Geordi and Data are too excited to sleep at their sleepover.
  • Picard is trapped inside a sentient turbolift. A clip show highlights the most memorable “Picard is trapped on a turbolift” moments.
PermalinkCommentshumor twitter tng tv

A whole Richard Feynman Talks collection by Brian Norgard...

2012 Feb 29, 10:19


A whole Richard Feynman Talks collection by Brian Norgard contains wonderful videos like this.

PermalinkCommentsrichard-feynman video science

URI Percent Encoding Ignorance Level 2 - There is no Unencoded URI

2012 Feb 20, 4:00

As a professional URI aficionado I deal with various levels of ignorance on URI percent-encoding (aka URI encoding, or URL escaping).

Getting into the more subtle levels of URI percent-encoding ignorance, folks try to apply their knowledge of percent-encoding to URIs as a whole producing the concepts escaped URIs and unescaped URIs. However there are no such things - URIs themselves aren't percent-encoded or decoded but rather contain characters that are percent-encoded or decoded. Applying percent-encoding or decoding to a URI as a whole produces a new and non-equivalent URI.

Instead of lingering on the incorrect concepts we'll just cover the correct ones: there's raw unencoded data, non-normal form URIs and normal form URIs. For example:

  1. http://example.com/%74%68%65%3F%70%61%74%68?query
  2. http://example.com/the%3Fpath?query
  3. "http", "example.com", "the?path", "query"

In the above (A) is not an 'encoded URI' but rather a non-normal form URI. The characters of 'the' and 'path' are percent-encoded but as unreserved characters specific in the RFC should not be encoded. In the normal form of the URI (B) the characters are decoded. But (B) is not a 'decoded URI' -- it still has an encoded '?' in it because that's a reserved character which by the RFC holds different meaning when appearing decoded versus encoded. Specifically in this case, it appears encoded which means it is data -- a literal '?' that appears as part of the path segment. This is as opposed to the decoded '?' that appears in the URI which is not part of the path but rather the delimiter to the query.

Usually when developers talk about decoding the URI what they really want is the raw data from the URI. The raw decoded data is (C) above. The only thing to note beyond what's covered already is that to obtain the decoded data one must parse the URI before percent decoding all percent-encoded octets.

Of course the exception here is when a URI is the raw data. In this case you must percent-encode the URI to have it appear in another URI. More on percent-encoding while constructing URIs later.

PermalinkCommentsurl encoding uri technical percent-encoding

(via Defend our freedom to share (or why SOPA is a bad idea):...

2012 Jan 18, 3:21


(via Defend our freedom to share (or why SOPA is a bad idea): Clay Shirky on TED.com)

PermalinkCommentsvideo copyright clay-shirky sopa pipa legal politics mpaa ted

Erik Wolpaw Talks In Depth About Portal 2 | Rock, Paper, Shotgun

2011 May 11, 7:45

Game Center Lecture Series- Erik Wolpaw from NYU Game Center on Vimeo.

PermalinkCommentsportal portal2 game videogame erik-wolpaw video

Lessig: Copyright isn't just hurting creativity: it's killing science (video) | Motherboard

2011 Apr 27, 2:22"Larry Lessig gave a new talk at CERN last week about copyright and how it has affected open access to academic or scientific information"

The Architecture of Access to Scientific Knowledge from lessig on Vimeo.

PermalinkCommentscopyright science lawrence-lessig video talk

TED Blog | The greatest TED Talk ever sold: Morgan Spurlock on TED.com

2011 Apr 6, 3:49 PermalinkCommentshumor video morgan-spurlock ted advertising ad

JavaScript & .NET interop via WebBrowser Control

2011 Apr 5, 10:00

For my GeolocMock weekend project I intended to use the Bing Maps API to display a map in a WebBrowser control and allow the user to interact with that to select a location to be consumed by my application. Getting my .NET code to talk to the JavaScript in the WebBrowser control was surprisingly easy.

To have .NET execute JavaScript code you can use the InvokeScript method passing the name of the JavaScript function to execute and an object array of parameters to pass:

this.webBrowser2.Document.InvokeScript("onLocationStateChanged",
new object[] {
latitudeTextBoxText,
longitudeTextBoxText,
altitudeTextBoxText,
uncertaintyTextBoxText
});

The other direction, having JavaScript call into .NET is slightly more complicated but still pretty easy as far as language interop goes. The first step is to mark your assembly as ComVisible so that it can interact with JavaScript via COM. VS had already added a ComVisible declaration to my project I just had to change the value to true.

[assembly: ComVisible(true)]

Next set ObjectForScripting attribute to the object you want to expose to JavaScript.

this.webBrowser2.ObjectForScripting = this.locationState;

Now that object is exposed as window.external in JavaScript and you can call methods on it.

window.external.Set(lat, long, alt, gUncert);

However you don't seem to be able to test for the existence of methods off of it. For example the following JavaScript generates an exception for me even though I have a Set method:

if (window.external && window.external.Set) {
PermalinkCommentsjavascript webbrowser .net technical csharp

Bluetooth Glove: Talk to the Hand!

2011 Mar 7, 9:13Instructions for a DIY bluetooth glove with mic in pinky and earpiece in thumb.
PermalinkCommentsbluetooth humor awesome phone diy

Berners Street Hoax - Wikipedia, the free encyclopedia

2010 Dec 6, 12:17Ye olde DoS: "The Berners Street Hoax was perpetrated by Theodore Hook in the City of Westminster, London, in 1809. Hook had made a bet with his friend, Samuel Beazley, that he could transform any house in London into the most talked-about address in a week, which he achieved by sending out thousands of letters in the name of Mrs Tottenham, who lived at 54 Berners Street, requesting deliveries, visitors, and assistance."PermalinkCommentshumor history prank

Everyone Hates Ticketmaster — But No One Can Take It Down | Magazine

2010 Nov 8, 3:32We were just talking about hating Ticketmaster. A brief history and business of Ticketmaster.PermalinkCommentsticketmaster software wired concert music business

Conan O’Brien Presents Show Zero – The Fastest Talk Show Ever

2010 Nov 2, 9:16PermalinkCommentsvideo conan-obrien talk-show humor tv
Older EntriesNewer Entries Creative Commons License Some rights reserved.