The How and Why of Hacking the U.N.

by Julian Todd

Normally, we think of the United Nations as a remote organization which puts representatives on the ground in the third-world, and pals around with heads of state in the developed world.  But back in 2006, a number of properties in my home city of Liverpool, England were raided by police in relation to an U.N. mandated financial sanctions regime.

I am not qualified to elaborate on these cases, except to note that the individuals arrested were alleged to be associated with the Libyan Islamic Fighting Group.  This group may have been supported by the British secret service MI6 during an assassination attempt against Colonel Muammar al-Gaddafi in 1996.  That was back when Gaddafi was a "bad" guy.  Suddenly, he became designated a "good" guy in 2006.

In 1999, the U.N. established an international financial sanctions regime through Security Council Resolution 1267.  This regime was set up to "target entities associated with Al-Qaeda, Osama bin Laden and/or the Taliban, wherever located."  It is implemented through a consolidated list of named individuals and organizations (posted on-line as a database dump) with whom it is punishable by law to have any unauthorized financial dealings.

The maintenance of this list is purely a matter for the Security Council.  It is quite clearly an extra-judicial process, as there is no right of legal defense before an impartial judge or recognizable due process of law.  In the early years of this regime, in the spirit of the infamous "No-Fly" lists, it seemed only to take a fax from the U.S. embassy containing the code-word Al-Qaeda or Taliban for someone's entire finances to be frozen, turning them into a beggar to whom it is illegal to give any money to.

This is not necessarily the fault of the United Nations.

There is a theme in politics where by governments intentionally launder somewhat questionable policies through a supranational organization (such as the EU, NAFTA, or the WTO) over which they have effective control, and to whom they are happy to transfer the associated unpopularity that comes from implementing that policy.

If you object to the U.N., you are missing the point.

The point is that the human race - as densely populous on this planet as it is - desperately needs a world organization that is capable of looking out for its long-term survival interests.  These interests are basic and technical, such as whether there is going to be enough food to survive in the next decade - which is a scary prospect because history has only ever been written by the folks who got by, so we don't see the real picture.

The U.N. is also needed to fill in for government incompetence around the world.  For example, the military junta who has just seized power in your own country probably doesn't rate the maintenance of the capitol's water supply high up on its list of priorities.  Yet when that collapses, there will be a great deal of unnecessary suffering and death.  The alternative to supporting the existence of internationally respected civilian agencies who act in the human interest is to leave this job open to Economic Hit Men, which leads to even greater sorrow.

But just because an organization is essential doesn't mean it's not politically corrupt and wide open to misuse by the stronger powers.  And I don't mean the fake corruption of the "Oil-for-Food" so-called scandal, which has been covered ad nauseam by the paid-for news stream; I mean questions that we should all be digging into in detail, doing the research that mysteriously has gone out of fashion just when, thanks the Internet, it's never been easier.

There are two main political bodies at the heart of the U.N.: the General Assembly and the Security Council.  Both of these produce verbatim transcripts of their official meetings and tables of the votes by member nations on any issue.

Security Council transcripts have the document code S/PV.1234 (the enumeration is from the first meeting of the Council on the 17 January 1946 in London, England).

General Assembly transcripts have the document code A/62/PV.100 (session 62, meeting 100).

These documents are in PDF form, and you cannot link to them on-line because they are Referer blocked.

That means that if you click on a link to one of these documents from within the United Nations website, you will get to see it, but if you put the URL directly into your browser, or link to it from a blog, you'll get an error.

In fact, what they've done is more complicated, as you can see if you click on one of the links from the official U.N. webpage; your URL bar in your browser appears to do a little dance and until it winds up with a completely different URL that works on your computer and on no one else's by the use of Internet cookies.

I have seen these "works-only-for-me" links posted onto many sites on the web, where the problem is invisible to the person who put them there.

Nevertheless, it is possible to unpick the process and successfully scrape a document from the U.N.'s servers to your own server using the following Python script:

#!/usr/bin/python

import urllib2, urlparse, re, cookielib

# This is the URL for the document S/PV.4701 in English
url = "http://daccess-ods.un.org/access.nsf/Get?Open&DS=S/PV.4701&Lang=E"

# This is the page on the UN website we pretend it was linked from
referrerurl = "http://www.un.org/Docs/scres/2002/sc2002.htm"
req = urllib2.Request(url)
req.add_header('Referer', url)
fin = urllib2.urlopen(req)
plenrefererforward = fin.read()
fin.close()

# This gives a dummy page that forwards the browser to a temporary page
mfore = re.search('URL=([^"]*)', plenrefererforward)
turl = urlparse.urljoin(url, mfore.group(1))

# This temporary page contains two forwarding links
fin = urllib2.urlopen(turl)
cookielink = fin.read()
fin.close()

# The first to the URL of the actual PDF page
mpdf = re.search('URL=([^"]*)', cookielink)
pdfurl = urlparse.urljoin(turl, mpdf.group(1))

# The second to a URL containing a cookie
mcookie = re.search('src="(http://daccessdds.un.org/[^"]*)', cookielink)
cookieurl = urlparse.urljoin(turl, mcookie.group(1))

# Take the cookies from the cookie link
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
fin = opener.open(cookieurl)
fin.close()

# You can't download the pdf unless you give it the cookie
fin = opener.open(pdfurl)
pdfdata = fin.read()
fin.close()

# Write the PDF data to your disk
fout = open("S-PV-4701.pdf", "wb")
fout.write(pdfdata)
fout.close()

Now... the transcript documents post-1994 are text PDF.

That means, with a lot parsing work, name matching, and correcting spelling mistakes, it is possible to extract text and produce structured HTML, so you can see all the votes by each country on each issue and tie them in with their Resolutions.

I have constructed a site for hosting these parsed documents and linking to them by individual speech and paragraph on my server at www.undemocracy.com.

Using this site it is possible to pursue interests in citizen journalism by referencing these documents from little-known Wikipedia articles, such as "World Television Day," the "Registration Convention," and the "Optional Protocol to the Convention on the Rights of the Child on the Sale of Children, Child Prostitution and Child Pornography."

Pre-1994, the United Nations documents are generally scanned images.

The transcripts of the Security Council meetings go back only as far as S-PV.2601 (26 June 1985), which means that the meetings relating to the U.S. invasion of Panama in 1989 and the excellent excuses given for it are all accessible.

Then there's a gap.

For some reason, the meetings between numbers 687 (4 January 1955) and 1021 (15 October 1962) are also online, providing a high-level window into those entertaining Cold War years right up to the Cuban Missile Crisis.

More recently, in the General Assembly, there's all manner of discussions that don't fit with the narrative put out by the usual news stream.  For example, in both 2000 and 2007 there were day long debates on the floor of the General Assembly in which everyone agreed with a resolution entitled: "Peace, security and reunification on the Korean peninsula."  Remember what happened to East Germany in 1990?

The stories are everywhere on every issue, not only North Korea.

Just because the documents are not marked classified doesn't mean they don't contain real information or that nobody is paying attention to them.  If the contents were more widely known, it would be a lot harder to fit the news stream around policies that required enemy missiles to be sited in places with illogical targets for illogical reasons, having been constructed by a nation with an incompetent government whose fund of natural born geeks are more than likely starving in the dark on a mountainside having had their family's corn-field washed away by a series of floods than learning their trade through the vibrant hacker underground.  Where do we think technology comes from?  This is not the 1980s, that innocent era with its Cold War games and the amazing story behind the bombing of Korean Flight 858, as recorded in S/PV/2791.  We've got bigger problems now than those made-up ones from an interesting, but obviously outdated past.

Speaking of made-up problems, the original plan, as outlined by the Secretary-General in document A/C.5/56/12 from 20 November 2001 entitled "Simultaneous availability of parliamentary documentation in electronic form in the six official languages on the United Nations web site," was to provide direct hyperlinks to the aforementioned documents on the Official Document Server.

It is unclear what changed this policy around, and my emails to them go unanswered.  Perhaps someone in New York could visit the Dag Hammarskjöld Library building at the United Nations Headquarters at the northeast corner of 42nd Street and 1st Avenue and get back to me with an explanation, while I carry on with what I can do from my distant home.

Code: un-grab.py

Return to $2600 Index