Anonymous Cambodia: The OPSEC disaster

June 17th, 2014 by qnrq

Pol-22-April-2014-09-18-17-47516

On the 30th August, 2012, a group of police officers met outside a local minimart near Riverside in Phnom Penh, Cambodia. Their mission was to raid and arrest anakata in his apartment located nearby as requested by Swedish authorities.

A group of hacktivists that calls itself NullCrew was quick to revenge carrying out attacks under the suitably chosen name: “Operation TPB”. On the 2nd September, 2012, they began leaking documents, usernames and passwords from Cambodian computer systems. They attacked the Cambodian Ministry of Public Works, the Institute of Standards, the general taxation department and the military. NullCrew’s attacks hit the local media and this is where the story about Anonymous Cambodia begins.

Most likely inspired by the press coverage of NullCrew’s attacks the Cambodian branch of Anonymous was formed. They adopted NullCrew’s OpTPB and on 12th September, 2012, the day after anakata landed in Sweden, it was reported that Anonymous Cambodia had broken into and leaked sensitive data extracted from the Cambodian Ministry of Foreign Affairs and defaced its website calling for anakata’s release.

The Cambodian branch went silent for a while only to wake up ready for the national elections held in July, 2013. They began defacing sites to spread their political message and DDoSing those that they could not deface accusing the ruling party of electoral fraud. Their mission was to topple the government lead by the Cambodian People’s Party which has ruled the country with an iron fist since the fall of Pol Pot and the Khmer Rouge regime.

“Because he has no formal training and uses programming scripts created by others, he said that he is a ‘script kiddie’ and not a true hacker.”

Less than two weeks before the election Anonymous Cambodia made their grand mistake. They participated in an interview with The Phnom Penh Post in which one of their members, “Black Cyber”, revealed personal information about himself and his agenda. In an interview with The Cambodia Daily he relied on “blacked-out webcam and computer software to distort his voice for fear that the call would be intercepted by U.S. intelligence agencies”.

Black Cyber was portrayed as a twenty-something IT security consultant who had become involved in Anonymous by participating in Operation Payback targeting pro-copyright, anti-piracy organizations and payment processors which had withdrawn banking facilities from WikiLeaks, similar to the attacks which would later be carried out as revenge for the arrest of The Pirate Bay founder anakata. Black Cyber denied involvement in OpTPB.

The interview given by Black Cyber provided excellent profiling data for law enforcement agencies. He revealed the size of Anonymous Cambodia and claimed that three people had participated in attacks against the National Election Committee. Jao Kamsot, another individual who was interviewed for the article, said that he is a script kiddie and not a true hacker.

“I don’t think their group has many people, and we will wipe it out.”

Immediately after the interview given by Black Cyber the Cambodian Ministry of Interior Department of Security began collaborating with the United States’ FBI in an investigation against Anonymous Cambodia. On 7th April, 2014, 21 year old Bun Khing Mongkul Panha, known online as Black Cyber, was arrested together with 21 year old Chou Songheng, alias Zoro.

The pair was charged with cyber crimes conducted against 30 government websites including the National Election Committee, Ministry of Foreign Affairs, Ministry of Defense, Anti-Corruption Unit and Phnom Penh Municipality. They were charged with unauthorized access to an automated data processing system, obstructing the functioning of an automated data processing system and fraudulent introduction, deletion or modification of data. Black Cyber confessed immediately.

On 22nd April, 2014, an individual calling itself “Attacker Fiber” created a Facebook page named after the group vowing revenge and posting YouTube videos showing how to conduct DDoS attacks. He used the page to market his own page (Attacker-Fiber) on which he advertised “Website Security Learning to be Anonymous” [sic] including SQL injection, defacement and backdoor techniques for $100 per course. He also set up a site titled “Cambodia Security” advertising the same services and posting guides for trivial things such as XAMPP installation.

On 29th April 2014 Anonymous Cambodia claimed on its Facebook page that they had breached the site belonging to the Anti-Corruption Unit promising further attacks. Dim Chaoseng, the lawyer defending the members of Anonymous Cambodia arrested earlier, expressed his concerns saying: “All the activity that Anonymous is doing at the moment is not going to help my clients. It is going to get more difficult to release my clients on bail.”

“…he said using a blacked-out webcam and computer software to distort his voice for fear that the call would be intercepted by U.S. intelligence agencies.”

Only days after the claimed attacks against the Anti-Corruption Unit, on 1st May 2014, two additional (unnamed) members of Anonymous Cambodia were arrested and charged with disrupting the ACU using the moniker Game-Over-xX23xX.

Angered by the four arrests, on the 4th May 2014, the group attacked the Royal Gendarmerie, Ministry of National Defense and CamCERT (Cambodia Computer Emergency Response Team) demanding the release of their “comrades”. Military Police spokesman Kheng Tito was quoted saying: “I don’t think their group has many people, and we will wipe it out.”

On 4th June Attacker Fiber, a 17 year old boy named Chin Neangleangmeng, became the 5th arrested member of Anonymous Cambodia. He confessed immediately.

Since the arrest of Attacker Fiber the small but very cocky group has been very quiet online. Anonymous Cambodia is now held in Prey Sar Prison in Phnom Penh, which was built for 500 inmates but was reportedly the home of 3,000 inmates in 2011, and they will most likely stay there until the authorities figure out how to punish them as Cambodia is currently lacking many internationally common cybercrime laws to regulate hacking and DDoS attacks.

SÄPO doesn’t have time for virus scans

June 8th, 2014 by qnrq

Earlier this week Torrentfreak reported that the Danish police investigating anakata for hacking charges had discovered that the analyzed computer had been hacked and infected by malware. Kristina Svartholm reported that the computer had been infected by more than 500 trojans.

Let’s rewind the tape from Denmark to Sweden, where the same computer (seizure 2012-0201-BG25023-26) was used as evidence against anakata. My translated version of the Swedish Security Service’s investigation of remote control possibilities can be downloaded from here. I also wrote a short paper in response to the investigation report which can be read here (tl;dr version available here).

The 12 SLOC Python example that I wrote and included in the paper played an important role in having all intrusion and fraud charges regarding the Nordea bank dropped. In the paper I also called the investigators biased for working with the assumption that computers can only be remotely controlled in legit ways, such as PowerShell and Remote Desktop mentioned by anakata as technical possibilities in hearings.

The Swedish Appeal court agreed with the points that I made and Jacob Applebaum pointed out in his witness testimony: remote control could not be excluded, hence the SÄPO investigation written by Jesper Blomström fell. Anakata was however sentenced for intrusions dated 2011 as it was considered “unlikely” that it would have been hacked since 2011 without notice.

A very important point to raise here is the fact that Jesper Blomström was the same person who made the discoveries of sensitive data originating from Denmark on the computer in question. He was also the one who rang to Denmark with his revelations. What Jesper found on the laptop and his investigation was the entire basis for extraditing Gottfrid from Sweden to face similar charges with evidence originating from the same harddrive as the court in Sweden had already ruled may have been remotely controlled.

Let’s revisit the court hearing with Jesper:

“I also think that it’s important to read the introduction of the PM when reading the conclusions, because we were given a task from the Stockholm County Police department that the computer had been remotely controlled first through one way that we investigated and then another that we controlled, so that you have that in the back of your head when you read the PM.”

“It’s when we write that we don’t see any programs that have been used for remotely controlling the computer. Based on the given task and the circumstances then in those frames we don’t see any traces.”

“It can be worth adding that we haven’t looked at every every file in every computer, because it’s like a giant haystack with enormous, thousands, of files in various ways. And then we would need to go through each individual program: is it this one that has remotely controlled, is it this, is it this, and that whole part. There hasn’t been any investigation like that on the computer because there is simply not enough time.”

The Swedish Security Service didn’t have time to do an antivirus scan on the computer and since the Stockholm County Police department didn’t specify it in their request nobody in Sweden appears to have scanned the computer for viruses.

This is outrageous on every level possible. Gottfrid was sentenced to jail in Sweden because the police didn’t have time to find anything that may have been in his favor. Guilty until proven innocent, eh?

This entire fiasco could have been avoided if Sweden had replaced the so called IT Security Specialists involved in the investigation with any ten year old from the street who learned Norton at Christmas family dinner, because obviously the computer was infected and obviously it was discovered as soon as somebody ran a virus scan.

Why I won’t work for Google

May 3rd, 2014 by qnrq

Hi Niklas,

Patrick here from Google.

I looked over your Github and LinkedIn profiles, and personal site (having found the panic_bcast project), and was keen to get in touch regarding a number of Engineering positions here at Google.

Your Open Source contributions and projects, Systems/Networking experience and development background looked relevant to what some of the engineers here are doing, but I wanted to touch base with you first to understand a bit more about your work.

If your schedule permits it, would you be open to a conversation next week?

The positions I had wanted to share with you are part of a mission-critical team that combines software development, networking and systems engineering expertise to build and run large scale, massively distributed, fault-tolerant software systems and infrastructure.

Thanks for your time and have a good weekend.

Best regards,
Patrick

Hi Patrick,

Thank you for reaching out to me and complimenting me on the panic_bcast project, it is always flattering being recognized by entities greater than oneself.

Before properly answering your question I would like to give you some background about myself and my relation to Google.

As a kid growing up Google would always be the most interesting employee one working in the technical industry could possibly imagine. Google would flex very playfully in line with its “Don’t do evil” agenda. I grew up as a very ideologically and principle driven individual, but foremost I was curios by nature. As a kid interested in information security and computers in general I quickly began exploring code by breaking it and systems by breaking into them driven by the force that information wanted to be free.

My father found out quickly and we had a long chat about life’s importance. He told me not to be wreckless because the future would consist of tyranny and powerless people. He told me that in the future the world’s power structures would depend much on what I would today categorize as cypherpunks and hackers.

I feel that the future that my father explained to me as a kid is today’s present. Google says “Don’t do evil” on one hand, but on another hand Google also reads the contents of its users’ emails and tracks their behavior on the Internet – two things which I would characterise as directly evil. Google reads the emails that my mother is writing and tracking what my friends are buying. For advertisement purposes, Google says, and we only discovered the true consequences later when Edward Snowden blew the whistle.

It turned out that Google had been helping American and European intelligence agencies illegally wiretap their own citizens. “We tried to fight back, we tried not to be evil!”, Google responds, but we never saw Google shut down its service in protest like Lavabit. We never saw Google fight back for the best of its users, which consists of a great majority of the world’s population. We saw Google justify its data inspection by saying that it was great for advertisement models.

We learned that Google is in fact doing very evil things to the majority of the world’s population. We learned that Google tends to sport the two edged sword. We learned that Google’s “open source as much as possible” policy only applies as long as they don’t disrupt existing flows of cash.

We witnessed Google sending cease and desist letters to the developers and maintainers of the popular Android CyanogenMod for violating some patents by modifying open source elements of an open source licensed project.

We learned that Google’s friendliness is a marketing scheme. We learned that Google is not what we thought it would be, that it is not fighting for what’s best for humanity but for what’s best for its own dollar.

I am different from Google in this sense. My principles are not compatible with those that Google is displaying and has displayed throughout history.

Due to my principles I would much rather delete all data Google has collected about its users which consists of myself, my family, my friends, my co-workers and everybody that they know that connects to and uses popular services on the public Internet. I would not be able to sleep at night knowing that I worked for a company which was directly threatening and targeting the people that I love.

I would never be able to develop the tyrannical tools required to keep the Google wheels spinning. I am on the opposite side of the spectra. The project which you acknowledged, panic_bcast, I wrote to make it harder for law enforcement officers to gather evidence on political activists through cold boot attacks. Other projects I am mainly involved in because I believe in a free unregulated stream of information on the public Internet.

I am one of those lucky individuals who can afford to work only on projects which I choose, and I choose to only involve myself in projects that I believe contribute something positive to the planet’s population. Google is not very high on that list, therefor I must respectfully decline your job offer.

“Gentlemen do not read each other’s mail.” – Henry L. Stimson

I wish you good luck on your quest to find the right candidate.

Regards,

Niklas

Life.

December 28th, 2013 by qnrq

Your consciousness spawns as a result of an imaginary nothing. You’re forced into an imaginary eternal maze purposefully filled with stress and anxiety.

Welcome to life: a game where players in your shoes have lost touch with nature and become mindless drones chasing fantasies of materialistic possessions backed by imaginary values, thus judging you thereafter – rather than character. On our deathbeds we’ll proudly tell the stories about all the megapixels we had, for that is what is most important.

Forget questioning, we’ll turn you into an outcast and stack the odds against you like Blackjack. We’ll guide you into temptation only to benefit from punishing you. We’ll call you sick, twisted and insane after paving the road and having established the pillars on which we built you.

Change, yes we can, everything except our opinions and habits, how else could we function? You can vote for the Pepsi or the Coke party, you see, we’re giving you a fair choice here. Like Henry Ford said it: you can have a car painted any color so long as it’s black. Did you wish to say something? Oh, sorry, we’ve run out of air time.

Swedish little piggy wants to shop invisibly

December 20th, 2013 by qnrq

Eight days ago I wrote about the mysterious events in Swedish aid donations to Cambodia in relation to anakata’s arrest year 2012, revealing that 2012 hit a peak with a ~$9,5 million increase which later dropped in 2013.

As usual the post was read by officials working for the Swedish government. More specifically the Swedish Defence Research Agency read the article at 2013-12-16 09:14:22 AM, at 09:15:19 AM they clicked the Creeper icon in the menu to the right (and discovered that their surfing habits were being publicly recorded) and at 09:15:51 AM they read about anakata’s uncontrollable computer:

qnrq.se *   2013-12-16 09:15:51 – FOI, Totalförsvarets forskningsinstitut
gnuheter.com *  2013-12-16 09:15:19 – FOI, Totalförsvarets forskningsinstitut
qnrq.se *   2013-12-16 09:14:22 – FOI, Totalförsvarets forskningsinstitut

Today I can reveal that between 16th and 20th December the Swedish aid to Cambodia was mysteriously modified to, instead of listing $26,400,000 like it did eight days ago, display the total sum for 2013 as $36,400,000.

Between today and four days ago, when the reveleation was read by the Swedish Defence Research Agency, the aid sum was bumped on OpenAid.se with an exact $10 million. There is currently no further explanation for where the extra $10 million has come from, but it is incredibly close to the estimated price for extracting anakata from Cambodia.

Was the extra $10 million actually spent or only added to the published statistics to make it look like a more natural development than the way it looks when the aid increases with 32.15% in 2012 only to drop again by 30.22% in 2013? Has Sweden purchased another hacker for extraction?

Either way: It’s very hard to escape the tinfoil style fashion speculation that this is a pure cover-up.

Swedish little piggy went to the market

December 12th, 2013 by qnrq

In 2012, after anakata’s arrest in Cambodia, suspicions rose that Sweden might have paid for his arrest through an increase in its annual aid package. The reasons being that only four days later Ambassadors signed a deal granting an all time high donation.

Anders Jörle, Swedish Ministry for Foreign Affairs spokesperson, was quoted in Swedish press calling the speculations about the oddly timed increase “ridicilously far-fetched”, but publicly released numbers show that perhaps money trail speculations were not that far from the truth.

What the published statistics show is that one of the highest donations occurred in 1997, at the time when Hun Sen rose to power through a military coup. 1997 was the year when the currently serving government rose to power through violence, not long after Pol Pot’s Khmer Rouge regime had fallen and Cambodia fell back to civil war standards. In relation to the rough times that Cambodia was facing in 1997 it is quite expected that Sweden would donate an all time high sum.

Yet, the 1997 donation is historically the 2nd largest sum donated to Cambodia by the Swedish government in form of aid. The largest donation occurred in 2012, coincidentally the same year as anakata was arrested in central Phnom Penh.

Not only was 2012 the largest total, it was also the largest modern percentage increase of 32.15% between 2011 and 2012, while the increase between 2010 and 2011 was only 6.25%. Coincidentally the total aid sum mysteriously dropped again between 2012 and 2013 by a good 30.22%.

In 2013 the same ministry, the Swedish Ministry for Foreign Affairs, released a report where they concluded that they didn’t really have any clue of how Sweden is handling aid money which is paid annually to countries considered in need of help.

The Swedish Ministry for Foreign Affairs report concluded that parts of the Swedish annual aid is handled by trainees and nobody is actually following up where the money is going.

In fact, everybody is so informed about how aid packages are received by third world countries in need that when Swedish SIDA in 2013 donated IT equipment to the Cambodian Ministry of Education Nath Bunroeun, Education Ministry Secretary of State, begged local officials not to bring it home for private use.

So, who took the ~9,400,000 paid by Sweden to extract anakata home?

Aid by year

1980 $12,300,000
1981 $8,730,000
1982 $8,340,000
1983 $5,460,000
1984 $8,460,000
1985 $3,110,000
1986 $4,449,000
1987 $1,080,000
1988 $0
1989 $5,270,000
1990 $3,580,000
1991 $3,170,000
1992 $19,200,000
1993 $10,100,000
1994 $5,670,000
1995 $3,970,000
1996 $14,300,000
1997 $30,400,000
1998 $14,200,000
1999 $7,550,000
2000 $16,800,000
2001 $16,900,000
2002 $14,500,000
2003 $18,700,000
2004 $22,500,000
2005 $14,400,000
2006 $17,200,000
2007 $17,900,000
2008 $16,100,000
2009 $23,900,000
2010 $24,000,000
2011 $28,300,000
2012 $35,800,000
2013 $26,400,000

anakata’s uncontrollable computer

September 5th, 2013 by qnrq

IT security specialists working for the Swedish Security Service Department of Information Security and Preservation of Evidence in IT environments performed forensics analysis on a computer seized from GSW and made the conclusion that it would be impossible to remotely control it without leaving traces, specifically seizure 2012-0201-BG25023-26. The problem is that they are wrong. The investigation report is originally written in Swedish, my translated version can be downloaded here.

The forensics analysis was isolated to the assumption that computers can only be remotely controlled via legit remote control services, such as Terminal Services and PowerShell. The forensics analysis focused on the services mentioned by the defendant and thus bypassed the possibility that, just like Nordea’s and Logica’s computers, the seized computer might as well just have been hacked unknowingly to the defendant; equal to how Logica was undetectably hacked for at least two years.

Yesterday, when Jacob Applebaum was heard as an expert witness called by the defense, the author of the report admitted that all contents of the seized computer’s harddrive had not been analyzed and that he is not a Windows expert.

The analysis assumes that only one firewall was present in the network: Windows Firewall, despite there being records of “plastic cover belonging to router” being handed over to Swedish authorities by Cambodian authorities. The router’s model version and firmware settings are uknown as it has neither been documented nor analyzed. Apparently seizing the plastic cover was a higher priority.

In their investigation the Security Service shows that Adobe Flash Player versions 11.0r1, 11.2.d202, 11.3.r300, 11.3.r400 and 11.3.402 had full permissions in the seized computer’s Windows Firewall rules to communiate over both TCP and UDP over any port in any direction. These versions of Adobe Flash Player are vulnerable to over 100 security issues which can be exploited to execute code through so called remote code execution exploits.

The computer’s Windows Firewall also allowed the Python interpreter to, just like all the other whitelisted applications, communicate over both TCP and UDP on any port and on any network device. Without going into further details in this post, here is a simple example of how a computer can be remotely controlled without leaving traces via Python:

import socket, subprocess

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM))
# Bind to port 9999 (example) on any network device
s.bind(("", 9999))
s.listen(1)
# Accept connections from clients
conn, addr = s.accept()

# Loop forever
while 1:
  # Read command sent from client
  data = conn.recv(1024)
  # Close link if no command is received
  if not data: break
  print("[+] Connection established")
  # Execute received command
  output = subprocess.check_output(data.decode().rstrip())
  # Send output of executed command back to the client
  conn.send("OUTPUT\n------\n".encode())
  conn.send(output)

conn.close()

When running the script above it creates a socket that listens on port 9999 which accepts connections on any network device on the computer. It then waits for clients to connect to it, reads received commands, executes them and returns the command output to the client. It’s not even complicated.

As an example this is what it looks like when a client connects to the server and lists the files in the current directory:

> telnet localhost 9999
Connected to localhost.
Escape character is '^]'.
ls
OUTPUT
------
server.py

In addition, the same scenario applies to another piece of software which was both installed and fully allowed in the local firewall: Neko.

Additionally the computer had both the OpenVPN client and server software installed enabling outsiders to connect to the computer and connecting the computer to additional networks, forming a Virtual Private Network, which is a globally routed virtual LAN. By directly connecting to the computer or by connecting the computer to an existing VPN other clients in the same VPN can share local resources, like harddrive storage, across the network.

Essentially it all boils down to that it is up to the software which enables remote control functionality to save logs to the harddrive. If the programmer doesn’t explicitly write such logging functionality, like in the Python example given above, logs are simply not stored to the disk. Windows does not write every network transmitted bit to the disk and unless someone logs their own backdooring it’s not going to be detected through forensics. Neither is the Python example demonstrated above detected by antivirus software as it is performing completely normal network operations.

You can obtain my somewhat lengthy comments written on this matter here. Please keep in mind that it was written under somewhat stressed circumstances where technological facts were more prioritized than human linguistic expression and spelling.

With more than 100 possibilities to remotely control the defendant’s computer without leaving traces, counting only those circumstances that paint the environmental picture in the Security Service’s investigation, it is absurd to claim that it would be impossible to remotely control the seized computer without leaving traces.

The authorities worked around the preresquites of justice when they first seized a router’s plastic cover instead of the router itself and later focused selectively on Windows Firewall. Analyzing the plastic cover would have had the same relevance as the investigation of remote control possibilities conducted by the Swedish Security Service.

Making the possible seem impossible is easy when the defendant’s documents are locked in a secret cabin and nobody has the ability to question you, but such actions does not promote true possibilities. It seems like the investigators were biased.

Solving the browser crypto problem

July 14th, 2013 by qnrq

Many developers have worked hard to port critical cryptographic functionality to JavaScript. We all agree that there is a clear requirement in a safer world to have asymmetric crypto support in the web. Porting code to JavaScript is great for users that don’t really care about the strength but only that the data is encrypted. Those people usually believe that they do not need perfect crypto, as long as it is any form of crypto it is “good enough” for them.

There are many problems with porting cryptographic functions directly to JavaScript and we see many great ideas failing on doing things properly. JavaScript cryptography is very young when comparing its lifespan to established binary solutions, such as GnuPG, that have been audited for long. GnuPG has been around since 1999 and GPG4Browsers, now OpenPGP.js, since 2011.

Auditing JavaScript ports leads to better design and less failures in time, but even when everything has been solved some problems remain due to design. Web browsers live in a very hostile world and we systematically witness XSS vulnerabilities and 0day exploits which enable dumping critical data, like private keys, as soon as either the DOM or HTML5 local storage is accessed. We can take care of badly implemented cryptography but we can’t take care of the way that the JavaScript implemented cryptography is accessible to anything that can execute JavaScript in the correct environment. As long as cryptography is done in JavaScript this will always be a huge threat.

The users that care more about their security and privacy are demanding solutions aligned with their requirements, and JavaScript implemented cryptography is by design insecure due to the surrounding threats in its domain. These users are actively choosing not to use JavaScript ported functionality but instead continue to use their local binaries that have been around and audited for decenniums more than newborn ports. And they are completely correct in doing so, because how can we actually trust JavaScript? We are stepping over the security requirements in order to deliver working solutions faster than science can keep up with it. We are impatient and we need something to work as soon as possible, especially in modern day and age with the ongoing war against free unmonitored online communication. By doing so we bypass the most important core ideas of implemented cryptography: security and privacy.

The solution

In order to expose GnuPG functionality to the web we must create an API for it which can perform cryptographic operations with non sensitive elements, such as armored public keys and private key metadata, without exposing anything of importance. The best way of doing it and successfully integrating it into web browsers is to run a webserver locally which pre accepted remotely served content can communicate with. The most important detail is that private keys should never ever be available for the web browser but instead reside in the local GnuPG keyring which the API manipulates through the local GnuPG binary.

I came up with a solution that I named pygpghttpd which I am currently working on supporting in my OpenPGP plugin for Roundcube: rc_openpgpjs. pygpghttpd is an open source minimalistic HTTPS server written in Python. pygpghttpd exposes an API enabling GnuPG’s cryptographic functionality to be used in web browsers and other software which allows HTTP requests. pygpghttpd runs on the client’s localhost and allows calling GnuPG binaries from the user’s browser securely without exposing cryptograhically sensitive data to hostile environments. pygpghttpd bridges the required elements of GnuPG to HTTP allowing its cryptographic functionality to be called without the need to trust JavaScript based PGP/GPG ports. As pygpghttpd calls local GnuPG binaries it is also using local keyrings and relying on it entirely for strength. In short pygpghttpd is just a dummy task router between browser and GnuPG binary.

pygpghttpd acts as a HTTPS server listening on port 11337 for POST requests containing operation commands and parameters to execute. When a request is received it checks the “Origin”, or if missing the “Referer”, HTTP header to find out which domain served the content that is contacting it. It then detects if the domain is added to the “accepted_domains.txt” file by the user to ensure that it is only operational for pre accepted domains. If the referring domain is accepted it treats the request and serves the result from the local GnuPG binary to the client. In the response a Cross-origin resource sharing HTTP header is sent to inform the user’s browser that the request should be permitted. If the referring domain is missing from accepted_domains.txt the user’s browser forbids the request in accordance with the same origin security policy.

The HTTPS certificate used by pygpghttpd is self signed and is not used with the intention to enhance security since all traffic is isolated to the local network interface. It uses HTTPS to ensure that both HTTPS and HTTP delivered content can interact with it.

pygpghttpd exposes metadata for both private and public keys but only allows public keys to be exported from the local keyring. The metadata for private keys is enough for performing cryptographic actions. Complete keypairs can be generated and imported into the local keyring.

For example, generating a keypair with cURL:

curl -k –data “cmd=keygen&type=RSA&length=2048&name=Alice&email=[email protected]&passphrase=foobar” -H “Origin: https://accepted.domain.com” https://localhost:11337/

Or from JavaScript:

$.post("https://localhost:11337/", {
  cmd: "keygen",
  type: "RSA",
  length: "2048",
  name: "Alice",
  email: "alice\@foo.com",
  passphrase: "foobar"
}, function(data) {
  if(data == "1")
    return true;
  return false;
});

Please see the project on Github, API documentation and example for full details.

Fending off attacks

June 18th, 2013 by qnrq

Dear readers,

As you may or may not have noticed, qnrq.se was inaccessible between Friday the 14th until Monday the 17th. The site was totally unavailable for 65 hours due to a powerful DDoS attack that knocked out my host’s cluster on which the site resides (195.74.38.18). Downtime doesn’t affect me as a publisher: there is nothing here that is not backed up and I don’t intend to financially gain from the visitors of this site. Instead, it affects you as a reader. It affects your ability to access the information that is being spread through this domain. This is a serious attack on your right to access information freely. Therefor I would like to address how this situation will be handled to ensure that you can, at bare minimum, always access the content that I provide.

There are no restrictions that prevent search engines and other crawlers from accessing content published on this site. If it goes down you can always view the content through, for example, Google’s cache or the Internet Archive. I have also installed and configured Cloudflare, which caches and delivers content through their CDN even when the site is inaccessible. Please keep in mind that Cloudflare is an American company which by law has to co-operate with the NSA and similar organizations. If you wish to hide your activities on this site from such organizations then please use an anonymization service like IPredator or Tor.

Cloudflare is the first non-Swedish service which is involved in delivering content on this site since I first put it online nearly two years ago. There are no Google Analytics or similar foreign tracking you here. My host, Binero, is a Swedish company with their servers placed in Sweden. The Flattr buttons you see all over the site are served by a Swedish company with servers in Sweden. The Creeper icon in the menu on the right side is served by a Swedish server run by a group of Swedish open source fanatics. The top domain? Swedish. You get the point.

Limiting the site to be served from within the Swedish borders has always been a conscious decision. Originally publications were mostly limited to Sweden and I didn’t want my visitors’ data to be sent to a lot of fishy people I have no idea of who they are. Later the site grew in popularity and I now have almost as many international visitors as I have Swedish.

I have to both fend off attacks and ensure acceptable performance. The site is being run with a very limited budget and implementing Cloudflare seems to be the best alternative from a both financial and performance perspective. Introducing an American company into the chain isn’t exactly my dream scenario but the availability is important for me. Unfortunately this creates a conflict with users that care about their privacy, especially around America.

I hope to satisfy both the performance parts and privacy parts in different means. I have stuck to the same host, Binero, for many years now, but the way that they handled the recent DDoS is entirely unacceptable to me. I am not going to deal with a host that requires me to contact them to move my site to a cluster which is not affected by the attack by pure principle (“because it causes downtime for the already DDoSed customers”, they claimed). My attitude is that if I am paying somebody to deliver me a service then I expect them to do everything in their power to ensure that the service is delivered and not require me to walk extra miles for them and then waiting for three days for their support to react. With those conditions I would much rather have as much as possible in my control, and that’s the next phase.

I am breaking up with Binero and moving the site to a dedicated Swedish VPS. For security and other considerations I will abandon PHP on the new host and serve WordPress generated pages statically. Everything will remain the same for you as a reader in terms of accessing and reading. The positive thing is that I won’t have to deal with intrusion attempts directed at PHP and WordPress and also Cloudflare will be configured to cache the static pages so that you can access them even when my host goes offline. The negative part is that you will no longer be able to leave comments on the site, but that may be fixed sometime in the future. When the site has been migrated to the new host it will also be available through HTTPS.

I believe that this is the best solution available, please let me know if you feel otherwise by commenting on this post.

Cheers, stay critical.

The extradition (Morgan part 7)

June 17th, 2013 by qnrq

Nacka District Court has granted prosecutor Henrik Olin permissions to extradite Anakata to Denmark in accordance with the Danish order for arrest. Anakata will remain in solitary confinement until the extradition is executed. Whether Anakata is allowed contacting the outside world is up to the prosecutor, Henrik Olin, in the Swedish hacking and fraud charges.

Extradition can be executed by earliest 25th June, given that the District Court finalizes the judgement on time. Prosecutor Henrik Olin decides in co-operation with the Danish authorities when the extradition shall be executed. The District Court’s decision can be appealed to the Swedish Court of Appeal.