Δευτέρα 12 Ιανουαρίου 2015

"The Gold Bug", Poe on Encryption

Recognized today as the undisputed master of the American Gothic horror story, Edgar Allan Poe (1809–1949) revealed his genius in tales of death, terror, evil, and perversity. Highly skilled in achieving a calculated psychological effect, Poe created chilling fictional nightmares permeated by mysterious forces, grotesque creatures, and improbable hallucinations.

"The Gold-Bug" is a short story by Edgar Allan Poe. Set on Sullivan's Island, South Carolina, the plot follows William Legrand, who was recently bitten by a gold-colored bug. His servant, Jupiter, fears Legrand is going insane and goes to Legrand's friend, an unnamed narrator, who agrees to visit his old friend. Legrand pulls the other two into an adventure after deciphering a secret message that will lead to a buried treasure.

The story involves cryptography with a detailed description of a method for solving a simple substitution cipher using letter frequencies. The cryptogram is:
53‡‡†305))6*;4826)4‡.)4‡);806*;48†8
¶60))85;;]8*;:‡*8†83(88)5*†;46(;88*96
*?;8)*‡(;485);5*†2:*‡(;4956*2(5*—4)8
¶8*;4069285);)6†8)4‡‡;1(‡9;48081;8:8‡
1;48†85;4)485†528806*81(‡9;48;(88;4
(‡?34;48)4‡;161;:188;‡?;

The decoded message is:
A good glass in the bishop's hostel in the devil's seat
twenty-one degrees and thirteen minutes northeast and by north
main branch seventh limb east side shoot from the left eye of the death's-head
a bee line from the tree through the shot fifty feet out.

(The actual decoded message omits spaces and capitalization)

In cryptography, a substitution cipher is a method of encoding by which units of plaintext are replaced with ciphertext, according to a regular system; the "units" may be single letters (the most common), pairs of letters, triplets of letters, mixtures of the above, and so forth. The receiver deciphers the text by performing an inverse substitution.
Traditionally, the ciphertext is written out in blocks of fixed length, omitting punctuation and spaces; this is done to help avoid transmission errors and to disguise word boundaries from the plaintext. These blocks are called "groups", and sometimes a "group count" (i.e., the number of groups) is given as an additional check. Five letter groups are traditional, dating from when messages used to be transmitted by telegraph.

Poe played a major role in popularizing cryptograms in newspapers and magazines in his time period and beyond. "The Gold-Bug" also includes the first use of the term "cryptograph" (as opposed to "cryptogram"). To most people in the 19th century, cryptography was mysterious and those able to break the codes were considered gifted with nearly supernatural ability. Poe had drawn attention to it as a novelty over four months in the Philadelphia publication Alexander's Weekly Messenger in 1840. He had asked readers to submit their own substitution ciphers, boasting he could solve all of them with little effort. The challenge brought about, as Poe wrote, "a very lively interest among the numerous readers of the journal. Letters poured in upon the editor from all parts of the country." In July 1841, Poe published "A Few Words on Secret Writing" and, realizing the interest in the topic, wrote "The Gold-Bug" as one of the few pieces of literature to incorporate ciphers as part of the story. Poe's character Legrand's explanation of his ability to solve the cipher is very like Poe's explanation in "A Few Words on Secret Writing". 

William F. Friedman, America's foremost cryptologist, initially became interested in cryptography after reading "The Gold-Bug" as a child—interest he later put to use in deciphering Japan's PURPLE code during World War II.

Σάββατο 13 Δεκεμβρίου 2014

POODLE Strikes Back

Recently surfaced a design vulnerability found in the way SSL 3.0 handles block cipher mode padding. The POODLE attack demonstrates how an attacker can exploit this vulnerability to decrypt and extract information from inside an encrypted transaction.

All systems and applications utilizing the Secure Socket Layer (SSL) 3.0 with cipher-block chaining (CBC) mode ciphers may be vulnerable. However, the POODLE (Padding Oracle On Downgraded Legacy Encryption) attack demonstrates this vulnerability using web browsers and web servers, which is one of the most likely exploitation scenarios.
Some Transport Layer Security (TLS) implementations are also vulnerable to the POODLE attack.

While SSL 3.0 is an obsolete and insecure protocol and for most practical purposes it has been replaced by its successors TLS 1.0, TLS 1.1, and TLS 1.2, many TLS implementations remain backwards­compatible with SSL 3.0 to interoperate with legacy systems in the interest of a smooth user experience.
The protocol handshake provides for authenticated version negotiation, so normally the latest protocol version common to the client and the server will be used.

The SSL 3.0 vulnerability stems from the way blocks of data are encrypted under a specific type of encryption algorithm within the SSL protocol. The POODLE attack takes advantage of the protocol version negotiation feature built into SSL/TLS to force the use of SSL 3.0 and then leverages this new vulnerability to decrypt select content within the SSL session. The decryption is done byte by byte and will generate a large number of connections between the client and server.
While SSL 3.0 is an old encryption standard and has generally been replaced by TLS, most SSL/TLS implementations remain backwards compatible with SSL 3.0 to interoperate with legacy systems in the interest of a smooth user experience. Even if a client and server both support a version of TLS the SSL/TLS protocol suite allows for protocol version negotiation (being referred to as the “downgrade dance” in other reporting). The POODLE attack leverages the fact that when a secure connection attempt fails, servers will fall back to older protocols such as SSL 3.0. An attacker who can trigger a connection failure can then force the use of SSL 3.0 and attempt the new attack.

Two other conditions must be met to successfully execute the POODLE attack:
  1. the attacker must be able to control portions of the client side of the SSL connection (varying the length of the input) and 
  2. the attacker must have visibility of the resulting ciphertext. The most common way to achieve these conditions would be to act as Man-in-the-Middle (MITM), requiring a whole separate form of attack to establish that level of access.
These conditions make successful exploitation somewhat difficult. Environments that are already at above-average risk for MITM attacks (such as public WiFi) remove some of those challenges.

On December 8, 2014, it was publicly reported that some TLS implementations are also vulnerable to the POODLE attack.

Removal of SSLv3 in favour of TLS because TLS fully specifies the contents of the padding bytes and thus stops the attack. However, TLS's padding is a subset of SSLv3's padding so, technically, you could use an SSLv3 decoding function with TLS and it would still work fine. It wouldn't check the padding bytes but that wouldn't cause any problems in normal operation. However, if an SSLv3 decoding function was used with TLS, then the POODLE attack would work, even against TLS connections.

Impact
The POODLE attack can be used against any system or application that supports SSL 3.0 with CBC mode ciphers. This affects most current browsers and websites, but also includes any software that either references a vulnerable SSL/TLS library (e.g. OpenSSL) or implements the SSL/TLS protocol suite itself. By exploiting this vulnerability in a likely web-based scenario, an attacker can gain access to sensitive data passed within the encrypted web session, such as passwords, cookies and other authentication tokens that can then be used to gain more complete access to a website (impersonating that user, accessing database content, etc.).

Mitigation
There is currently no fix for the vulnerability SSL 3.0 itself, as the issue is fundamental to the protocol; however, disabling SSL 3.0 support in system/application configurations is the most viable solution currently available.
Some of the same researchers that discovered the vulnerability also developed a fix for one of the prerequisite conditions; TLS_FALLBACK_SCSV is a protocol extension that prevents MITM attackers from being able to force a protocol downgrade. OpenSSL has added support for TLS_FALLBACK_SCSV to their latest versions and recommend the following upgrades:
  • OpenSSL 1.0.1 users should upgrade to 1.0.1j.
  • OpenSSL 1.0.0 users should upgrade to 1.0.0o.
  • OpenSSL 0.9.8 users should upgrade to 0.9.8zc.
Both clients and servers need to support TLS_FALLBACK_SCSV to prevent downgrade attacks.

Κυριακή 7 Δεκεμβρίου 2014

The Site's Security Certificate is not Trusted. Proceed?

When you visit a website whose web address starts with https, your communication with the site is encrypted to help ensure your privacy. When you navigate to a site that uses SSL to transmit data, the server which hosts that website presents your browser with a certificate to verify its identity. This certificate contains information such as the address of the website, which is confirmed by a third party organization that your browser trusts. By checking that the address in the certificate matches the address of the website, it's possible to verify that you're communicating with the website named on the certificate, and not someone pretending to be that website.

What Is an SSL Certificate? An SSL certificate is a digital computer file (or small piece of code) that has two specific functions:
  1. Authentication and Verification: The SSL certificate has information about the authenticity of certain details regarding the identity of a person, business or website, which it will display to visitors on your website when they click on the browser's padlock symbol or trust mark . The vetting criteria used by Certificate Authorities to determine if an SSL certificate should be issued is most stringent with an Extended Validation (EV) SSL certificate: making it the most trusted SSL certificate available. 
  2. Data Encryption: The SSL certificate also enables encryption, which means that the sensitive information exchanged via the website cannot be intercepted and read by anyone other than the intended recipient.
In the same way that a identity document or passport may only be issued by the country's government officials, an SSL certificate is most reliable when issued by a trusted Certificate Authority (CA). The CA has to follow very strict rules and policies about who may or may not receive an SSL certificate.When you have a valid SSL certificate from a trusted CA. there is a higher degree of trust by your customers, clients or partners.

How Does SSL Encryption Work? In the same way that you lock and unlock doors using a key, encryption makes use of keys to bck and unlock your information. Unless you have the right key, you will not be able to "open" the information. Each SSL session consists of two keys:
  • The public key is used to encrypt (scramble) the information.
  • The private key is used to decrypt (unscramble) the information and restore it to its original format so that it can be read.
The following warnings are presented by web browsers when you access a site that has a security certificate installed (for SSL/TLS data encryption) that cannot be verified by the browser.
  • Google Chrome: "The site's security certificate is not trusted!"
  • Internet Explorer: "There is a problem with this website's security certificate. The security certificate presented by this website was not issued by a trusted certificate authority."
  • Firefox: "This Connection is Untrusted"
Browsers are made with a built-in list of trusted certificate providers. For some sites, the certificate provider is not on that list. If this is the case, the browser will warn you that the Certificate Authority (CA) who issued the certificate is not trusted. This issue can also occur if the site has a self-signed certificate. Self-signed certificates aren't trusted by browsers because they are generated by the server admin, not by a CA.

The most common cause of a "certificate not trusted" error is that the certificate installation was not properly completed on the server (or servers) hosting the site.

Seeing the alert does not necessarily mean that the website you're visiting is trying to trick you into believing it is a different website - it means that you browser is not able to verify the identity of the website, and that you should proceed carefully. The safest thing to do is to cancel your navigation to the site, or to go to a different one. Unless you know and understand the technical reason why the website presented incorrect identification, and are willing to risk communicating over a connection that could be vulnerable to an eavesdropper, you should not proceed to the website. If possible, you should contact the owners of the website and inform them of the error.

Παρασκευή 21 Νοεμβρίου 2014

Let's Make HTTPS the Standard and not the Exception

On November 18th, EFF announced Let’s Encrypt, a new certificate authority (CA) initiative that we have put together with Mozilla, Cisco, Akamai, IdenTrust, and researchers at the University of Michigan that aims to clear the remaining roadblocks to transition the Web from HTTP to HTTPS.

Although the HTTP protocol has been hugely successful, it is inherently insecure. Whenever you use an HTTP website, you are always vulnerable to problems, including account hijacking and identity theft; surveillance and tracking by governments, companies, and both in concert; injection of malicious scripts into pages; and censorship that targets specific keywords or specific pages on sites. The HTTPS protocol, though it is not yet flawless, is a vast improvement on all of these fronts, and we need to move to a future where every website is HTTPS by default.With a launch scheduled for summer 2015, the Let’s Encrypt CA will automatically issue and manage free certificates for any website that needs them. Switching a webserver from HTTP to HTTPS with this CA will be as easy as issuing one command, or clicking one button.

The biggest obstacle to HTTPS deployment has been the complexity, bureaucracy, and cost of the certificates that HTTPS requires. We’re all familiar with the warnings and error messages produced by misconfigured certificates. These warnings are a hint that HTTPS (and other uses of TLS/SSL) is dependent on a horrifyingly complex and often structurally dysfunctional bureaucracy for authentication.

The need to obtain, install, and manage certificates from that bureaucracy is the largest reason that sites keep using HTTP instead of HTTPS. In tests conducted by EFF, it typically takes a web developer 1-3 hours to enable encryption for the first time. The Let’s Encrypt project is aiming to fix that by reducing setup time to 20-30 seconds. You can help test and hack on the developer preview of Let's Encrypt agent software.

Let’s Encrypt will employ a number of new technologies to manage secure automated verification of domains and issuance of certificates. It will use a protocol called ACME between web servers and the CA, which includes support for new and stronger forms of domain validation. It will also employ Internet-wide datasets of certificates, such as EFF’s own Decentralized SSL Observatory, the University of Michigan’s scans.io, and Google's Certificate Transparency logs, to make higher-security decisions about when a certificate is safe to issue.

The Let’s Encrypt CA will be operated by a new non-profit organization called the Internet Security Research Group (ISRG). EFF helped to put together this initiative with Mozilla and the University of Michigan, and it has been joined for launch by partners including Cisco, Akamai, and Identrust.

The core team working on the Let's Encrypt CA and agent software includes James Kasten, Seth Schoen, and Peter Eckersley at EFF; Josh Aas, Richard Barnes, Kevin Dick and Eric Rescorla at Mozilla; Alex Halderman and James Kasten and the University of Michigan.

Πέμπτη 20 Νοεμβρίου 2014

The Imitation Game: Historical Figures of Cryptanalysis

The Imitation Game was released in the United Kingdom on 14 November 2014, and will be released theatrically in the United States on 28 November 2014. The film portrays the race against time by Alan Turing and his team of code-breakers at Britain's top-secret Government Code and Cypher School at Bletchley Park, during the darkest days of World War II. The motley group of scholars, mathematicians, linguists, chess champions and intelligence officers had a powerful ally in Prime Minister Winston Churchill who authorized the provision of any resource they required. The film spans the key periods of Turing's life: his unhappy teenage years at boarding school; the triumph of his secret wartime work on the revolutionary electro-mechanical bombe that was capable of breaking 3,000 Enigma-generated naval codes a day; and the tragedy of his post-war decline following his conviction for gross indecency, a now-outdated criminal offence stemming from his admission of maintaining a homosexual relationship.

As you can understand rating films is not in the scope of this blog, so we will deal with two of the characters that are legends in information security history.

Alan Turing (Benedict Cumberbatch)

Alan Mathison Turing, OBE, FRS  [Order of the British Empire] [Fellows of the Royal Society] (23 June 1912 – 7 June 1954) was a British mathematician, logician, cryptanalyst, philosopher, pioneering computer scientist, mathematical biologist, and marathon and ultra distance runner. He was highly influential in the development of computer science, providing a formalisation of the concepts of "algorithm" and "computation" with the Turing machine, which can be considered a model of a general purpose computer. Turing is widely considered to be the father of theoretical computer science and artificial intelligence.

During World War II, Turing worked for the Government Code and Cypher School (GC&CS) at Bletchley Park, Britain's codebreaking centre. For a time he led Hut 8, the section responsible for German naval cryptanalysis. He devised a number of techniques for breaking German ciphers, including improvements to the pre-war Polish bombe method, an electromechanical machine that could find settings for the Enigma machine. Winston Churchill said that Turing made the single biggest contribution to Allied victory in the war against Nazi Germany. Turing's pivotal role in cracking intercepted coded messages enabled the Allies to defeat the Nazis in several crucial battles. It has been estimated that Turing's work shortened the war in Europe by as many as two to four years.

After the war, he worked at the National Physical Laboratory, where he designed the ACE, among the first designs for a stored-program computer. In 1948 Turing joined Max Newman's Computing Laboratory at Manchester University, where he assisted development of the Manchester computers and became interested in mathematical biology. He wrote a paper on the chemical basis of morphogenesis, and predicted oscillating chemical reactions such as the Belousov–Zhabotinsky reaction, first observed in the 1960s.

Turing was prosecuted in 1952 for homosexual acts, when such behaviour was still criminalised in the UK. died in 1954, 16 days before his 42nd birthday, from cyanide poisoning. An inquest determined his death a suicide; his mother and some others believed it was accidental. On 10 September 2009, following an Internet campaign, British Prime Minister Gordon Brown made an official public apology on behalf of the British government for "the appalling way he was treated." The Queen granted him a posthumous pardon on 24 December 2013.

Joan Clarke (Keira Knightley)

Joan Elisabeth Lowther Murray, MBE [Member of the Most Excellent Order of the British Empire] (née Clarke; 24 June 1917 – 4 September 1996) was an English cryptanalyst and numismatist. She worked as a code-breaker at Bletchley Park during World War II. Joan Elisabeth Lowther Clarke was born on 24 June 1917 in West Norwood, London, the youngest child of Dorothy (née Fulford) and the Rev William Kemp Lowther Clarke, a clergyman. She had three brothers and one sister.

She attended Dulwich High School for Girls in south London and won a scholarship to attend Newnham College, Cambridge where she gained double first degree in mathematics and was a Wrangler.

Clarke and fellow code-breaker Alan Turing became very good friends at Bletchley Park. Turing would arrange their shifts so they could be working together, as well as spending a lot of their free time together. In the spring of 1941, Turing proposed marriage to Clarke and subsequently introduced her to his family. After admitting his homosexuality to his fiancée, who was reportedly "unfazed" by the revelation, Turing decided that he could not go through with the marriage and he broke up with Clarke in the summer of 1941. After the war Clarke worked for GC&CS where she met Lieutenant-Colonel John Kenneth Ronald Murray and got married. Shortly after their marriage John Murray retired from GC&CS due to ill health and the couple moved to Crail in Scotland. They returned to work at GC&CS in 1962 where Clarke remained until 1977 when she retired aged 60.

Following her husband's death in 1986, Clarke moved to Headington, Oxfordshire, where she continued her research into coinage. During the 1980s she assisted Sir Harry Hinsley with the appendix to volume 3, part 2 of British Intelligence in the Second World War. She assisted historians studying war-time code breaking at Bletchley Park. Due to continuing secrecy among cryptanalysts, the full extent of her accomplishments remains unknown. On 4 September 1996, Joan Clarke Murray died at her home in Headington.

Παρασκευή 31 Οκτωβρίου 2014

Android Lollipop Security Features

Google is reportedly offering data encryption in its upcoming Android platform – Android L(ollipop), by default. Though Google has been providing data encryption capability since past three years, it had been kept optional. The company assures users that keys/passcodes are not stored online or anywhere off your device, so Google has no way to share them. It is, however, widely accepted that majority of the users were unaware of this option. Hence, now users don’t even have to bother about turning it on, with default settings in place. The new security strategy comes hot on the heels of Apple announcing that users' data on iOS 8 is protected by passwords that even Apple cannot access. Expanded deployment of encryption by Google and Apple, however, will have the most direct impact on law enforcement officials, who  have long warned that restrictions on their access to electronic devices make it much harder for them to prevent and solve crimes. Google does not have the ability to deliver its updated operating system, called the “L-release,” quickly to most users. Several different manufacturers make smartphones and tablets that use the Android operating system, and those devices are sold by many cellular carriers worldwide. This results in what experts call “fragmentation” – meaning there are hundreds of different versions of Android worldwide, many several years old, making it difficult to keep them current with the latest security features. The newest Android devices will likely ship with default encryption in a few days, but it will take many months and probably years before most Android devices have encryption by default.


The latest version of the mobile OS has amped up its deployment of Security Enhanced Linux (SE Android) in order to bring security policy enforcement to the kernel level, and has also switched device encryption on by default.
You can authorize apps with high-level permissions and deep down they’re being granted a lot more access than necessary. With SE Android, Google is expanding and getting more fine-grained controls and containment,” said Zach Lanier, senior security researcher with Duo Labs, the research division of Duo Security. With SE Android, you’re much closer to having a real sandbox.

SE Linux has been in Android since version 4.4, but now all application enforcement is being pulled into the OS kernel. Google lead security engineer for Android Adrian Ludwig said this makes security auditing and monitoring easier on the device.
With Android 5.0, SELinux Enforcing mode is required for all applications on all devices,” Ludwig said. “Multiple vulnerabilities have been prevented since we first introduced SELinux last year; by strengthening it even more, Android becomes a top choice for enterprise customers that have really strict security standards, such as the government.

There are also rumors about multiple accounts per device, that would allow users to separate business form personal functions. The new Android for Work solution (which incorporates Samsung KNOX features) will address these issues by creating an encrypted storage and a virtual environment, basically, a smartphone inside a smartphone. After launching Android for Work, a user will see a “business home screen” with company-approved apps and can perform his/her duties using encrypted data and an encrypted Internet connection. One click ― and his/her personal home screen and apps are back. Private and work-related apps and data are fully isolated, e.g. the company email app cannot read users’ personal address book or photo library, and vice versa.

Google developers briefly mentioned something called Universal Data Controls, a centralized tool helping a user identify items like which apps, what kind of his/her personal data and what should be blocked for an individual’s smartphone. Unfortunately, there are few details on the subject. We will have to wait a few more days to take a closer look at this function.

If you're buying a Nexus 6 or Nexus 9, you can get Android Lollipop from November 3rd (if you're in the UK, you'll be able to pre-order in November and receive your phablet or tablet within a few weeks). But if you already have a Nexus 5, 7 or 10 you should get it in a free over-the-air update in the "coming weeks" according to Google's blog

Κυριακή 28 Σεπτεμβρίου 2014

Privacy is in the eye of the beholder

Recent articles - like this and this - state that FBI and NSA are greatly concerned about the new encryption algorithm that the latest iPhone models use.

Apple has tried hard to persuade iPhone users, by also updating their policy, that their privacy is well guarded and that even government authorities have a hard time breaking the encryption of their devices. The phone encrypts emails, photos and contacts based on a complex mathematical algorithm that uses a code created by, and unique to, the phone’s user — and that Apple says it will not possess.

As of 2009, non-military cryptography exports from the U.S. are controlled by the Department of Commerce's Bureau of Industry and Security. Some restrictions still exist, even for mass market products, particularly with regard to export to "rogue states" and terrorist organizations. Militarized encryption equipment, TEMPEST-approved electronics, custom cryptographic software, and even cryptographic consulting services still require an export license. Furthermore, encryption registration with the BIS is required for the export of "mass market encryption commodities, software and components with encryption exceeding 64 bits". In addition, other items require a one-time review by or notification to BIS prior to export to most countries. For instance, the BIS must be notified before open-source cryptographic software is made publicly available on the Internet, though no review is required. Export regulations have been relaxed from pre-1996 standards, but are still complex. Other countries, notably those participating in the Wassenaar Arrangement, have similar restrictions.

The Wassenaar Arrangement has been established in order to contribute to regional and international security and stability, by promoting transparency and greater responsibility in transfers of conventional arms and dual-use goods and technologies, thus preventing destabilizing accumulations. Participating States seek, through their national policies, to ensure that transfers of these items do not contribute to the development or enhancement of military capabilities which undermine these goals, and are not diverted to support such capabilities. Category 5 - Part 2 of Wassenaar Arrangement is titled Information Security and states the rules that govern 'The status of "information security" equipment, "software", systems, application specific "electronic assemblies", modules, integrated circuits, components or functions is determined in Category 5, Part 2 even if they are components or "electronic assemblies" of other equipment'. 

Though I am not a lawyer, and I also hate conspiracy theories, I cannot but deduce that government authorities in the US are fully aware of the encryption technology that is exported. This does not automatically solve their problem to eavesdrop encrypted data, but it gives them a good head start.

According to an Apple technical guide, breaking the code could take “more than 5 1/2 years to try all combinations of a six-character alphanumeric passcode with lowercase letters and numbers". This statement made me use the passfault password analyzer, a free tool offered by OWASP.

The scenario is simple, a 6 character alphanumeric password that follows simple password complexity rules.
Under the best encryption algorithm provided by the tool (Unix BCrypt Hash), it takes from 3 days to 1 year and 9 months to break the password, depending on the equipment used. And yes, the 3 days corresponds to government-level equipment.

The choice is yours...