diff --git a/puzzles/webapp/80/,binary.png b/puzzles/webapp/80/,binary.png new file mode 120000 index 0000000..36053bd --- /dev/null +++ b/puzzles/webapp/80/,binary.png @@ -0,0 +1 @@ +../10/,binary.png \ No newline at end of file diff --git a/puzzles/webapp/80/,ctf.css b/puzzles/webapp/80/,ctf.css new file mode 120000 index 0000000..19b2533 --- /dev/null +++ b/puzzles/webapp/80/,ctf.css @@ -0,0 +1 @@ +../10/,ctf.css \ No newline at end of file diff --git a/puzzles/webapp/80/,jokes/bar b/puzzles/webapp/80/,jokes/bar new file mode 100644 index 0000000..9e0dfe3 --- /dev/null +++ b/puzzles/webapp/80/,jokes/bar @@ -0,0 +1,4 @@ +

An unsigned integer walks into a bar and orders a drink.
+The bartender delivers it and says, "Is something wrong?"
+The int looks up and replies, "Parity error."
+"Ah," the bartender replies, "I thought you looked a bit off."

diff --git a/puzzles/webapp/80/,jokes/binary b/puzzles/webapp/80/,jokes/binary new file mode 100644 index 0000000..58ddc26 --- /dev/null +++ b/puzzles/webapp/80/,jokes/binary @@ -0,0 +1,2 @@ +

There are 10 types of people in the world: those who understand binary and those who don't.

+ diff --git a/puzzles/webapp/80/,jokes/christmas b/puzzles/webapp/80/,jokes/christmas new file mode 100644 index 0000000..3bade53 --- /dev/null +++ b/puzzles/webapp/80/,jokes/christmas @@ -0,0 +1,2 @@ +

Why do programmers confuse Halloween and Christmas?

+Because OCT 31 == DEC 25!

diff --git a/puzzles/webapp/80/,jokes/help b/puzzles/webapp/80/,jokes/help new file mode 100644 index 0000000..e79c54b --- /dev/null +++ b/puzzles/webapp/80/,jokes/help @@ -0,0 +1,2 @@ +

Once a programmer drowned in the sea. Many people were at the beach at the time, +but the programmer was shouting "F1! F1!" and nobody understood it.

diff --git a/puzzles/webapp/80/,jokes/java b/puzzles/webapp/80/,jokes/java new file mode 100644 index 0000000..9c5e84d --- /dev/null +++ b/puzzles/webapp/80/,jokes/java @@ -0,0 +1,6 @@ +

"Knock, Knock."
+"Who's there?"
+
+... long pause ...
+
+"Java."

diff --git a/puzzles/webapp/80/,makedb.py b/puzzles/webapp/80/,makedb.py new file mode 100755 index 0000000..0c1ea7c --- /dev/null +++ b/puzzles/webapp/80/,makedb.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python2.6 + +import os +import sys +import sqlite3 +import base64 + +# new db +if os.path.exists(',zomg.sqlite3'): + os.remove(',zomg.sqlite3') +db = sqlite3.connect(',zomg.sqlite3') +cur = db.cursor() + +# pics table +cur.execute('create table pics(id integer primary key, data blob)') +paths = os.listdir(',pics/') +for path in paths: + f = open(os.path.join(',pics/', path), 'rb') + data = f.read() + f.close() + encoded = base64.encodestring(data) + html = '' % encoded + cur.execute('insert into pics(data) values(?)', (html,)) + +# jokes table +cur.execute('create table jokes(id integer primary key, data text)') +paths = os.listdir(',jokes/') +for path in paths: + f = open(os.path.join(',jokes/', path), 'r') + html = f.read() + f.close() + cur.execute('insert into jokes(data) values(?)', (html,)) + +# key +cur.execute('create table key(id integer primary key, data text)') +for k in [None, None, None, None, None, 'dmW5f9P54e']: + cur.execute('insert into key(data) values(?)', (k,)) + +# clean up +db.commit() +cur.close() +db.close() + diff --git a/puzzles/webapp/80/,pics/90s.jpg b/puzzles/webapp/80/,pics/90s.jpg new file mode 100644 index 0000000..5e31456 Binary files /dev/null and b/puzzles/webapp/80/,pics/90s.jpg differ diff --git a/puzzles/webapp/80/,pics/melon.jpg b/puzzles/webapp/80/,pics/melon.jpg new file mode 100644 index 0000000..4ed92f5 Binary files /dev/null and b/puzzles/webapp/80/,pics/melon.jpg differ diff --git a/puzzles/webapp/80/,pics/pumpkin.jpg b/puzzles/webapp/80/,pics/pumpkin.jpg new file mode 100644 index 0000000..cca7efc Binary files /dev/null and b/puzzles/webapp/80/,pics/pumpkin.jpg differ diff --git a/puzzles/webapp/80/,pics/ruth.jpg b/puzzles/webapp/80/,pics/ruth.jpg new file mode 100644 index 0000000..46ea699 Binary files /dev/null and b/puzzles/webapp/80/,pics/ruth.jpg differ diff --git a/puzzles/webapp/80/,pics/soccer.jpg b/puzzles/webapp/80/,pics/soccer.jpg new file mode 100644 index 0000000..b2f1ba7 Binary files /dev/null and b/puzzles/webapp/80/,pics/soccer.jpg differ diff --git a/puzzles/webapp/80/,zomg.sqlite3 b/puzzles/webapp/80/,zomg.sqlite3 new file mode 100644 index 0000000..4b5bf1f Binary files /dev/null and b/puzzles/webapp/80/,zomg.sqlite3 differ diff --git a/puzzles/webapp/80/8.cgi b/puzzles/webapp/80/8.cgi new file mode 100755 index 0000000..4d2a23a --- /dev/null +++ b/puzzles/webapp/80/8.cgi @@ -0,0 +1,150 @@ +#!/usr/bin/python + +import os +import cgi +import cgitb +import sqlite3 +cgitb.enable(context=10) + +if os.environ.has_key('QUERY_STRING'): + os.environ['QUERY_STRING'] = '' + +fields = cgi.FieldStorage() + +q = None +if fields.has_key('q'): + q = fields['q'].value + +if q is not None: + print 'Content-Type: text/html\n' + try: + db = sqlite3.connect(',zomg.sqlite3') + cur = db.cursor() + cur.execute(q) + results = cur.fetchall() + + print '' + for r in results: + print '' + for thing in r: + print '' % thing + print '' + print '
%s
' + + except Exception: + print '

Invlaid query: %s

' % q + +else: + print 'Content-Type: text/html\n' + print '' + + print ''' + + + 8 + + + + +
+
+

Web Application Challenge 8

+

Through some manipulation or interpretation of this CGI script + and the HTML page(s) that it generates, a 10 character key can be + found.

+

Find the key!

+ +
+

Database Query Wizard

+

Use the form below to retrieve data from the database. Select the + type of data that you would like to view and the number of database + entries to retrieve and then click on the "Query" button.

+ +
+
+ Topic: +

+ # Results: +

+ +
+ +
+
+ +
+ + + ''' + diff --git a/puzzles/webapp/summary.txt b/puzzles/webapp/summary.txt index 23fb9f8..03f7ce0 100644 --- a/puzzles/webapp/summary.txt +++ b/puzzles/webapp/summary.txt @@ -12,3 +12,6 @@ cookie, hopefully causing the player to take a look at the cookie. 70: modify the cookie's content_name field to something invalid, reload the page and the key will be printed on the page. +80: an sql query is being constructed in javascript from form fields. change the + form fields such that the query is SELECT * FROM key LIMIT 6 and the key will + be displayed.