The Faraj Initiative

العربية

The pillars of secure communication when a device is comproised

Published on: , Last updated on:

This work on progress, check back later... You can track the progess there though

Important note: the software used to generate key pairs might not even trust worthy, given to be sure a 100% number is prime it will take long time, thus algorthim might the calucalte it relies in probability.

Important note: this gudie might be releavnt to secure data tranmission between parties, but it doesn't or is irreleavnt for anonymity. In ohter wordes it will help you about the "What" of what you sent not the "To whom?" you send it.

In this digital age, communicating has became so simple, easy, and almost free. However this comes with another cost, our privacy, and even survival for some.

This might not be a matter or a concern for most poeple. However if you are journalists, activist then it could mean your freedom, or even your life.

This article is diveded in two sections, the first section outlines some basic facts in cypersecuirty and cryptography. While the second section is focused on a practial and hands on how-tos guide, to communicate securely. However please note, while I've put a countless number of hours in researching, and studying this topic, I am not cypersecuirty or cryptography expert. So please take this guide with a grain of salt. And if you find any mistake, or have any suggestion, please reach out.

Section 1: Facts and Best Practices

In this section, I outlines some facts and best practices in (cypersecurity, and cryptography). The goal of this section, firstly is to provide reader some background and contxt in this field and secondly to provide a foundation for the next section. In this section, I make use of the term fact,

Fact 1 (Assumed Breach)

We can never be certain that our devices are 100% secured, so we assume our that our devices are compromised.

Putting cypersecurity aside...Here we are just considering the worst case scenario, and this is not a new concept, it's an axiom in risk management, engineering, and many other fields.

Back to cyper-secuirty, there is a model or architecture called Zero Trust, where you assume that your network/device[1] is already compromised, and you build your security around this assumption.

Fact 2 (E2EE limitation)

End to end encryption is not enough to protect your communication if your device is compromised.

Let's take a step back, and note that end to end encryption means is that: data is encrypted while on transit. In other words, when an e2e communication medium is e2e like (whatsapp, telegram, or signal ..etc) is going to procetct your data while it's on transit, but not necessary when your data is safe while it's on your device (hence the frist fact).

But wait, does this mean end-to-end encryption is useless?

Is the safety belt useless because it cannot protect aginst an excavator accident?

Again here we are always assuming the worst most extreme case scenario.

Fact 3 (Air Gapped)

A compromised device cannot leak information if it's not connected to the internet or any other device.

Ths is just how physics work, no?, How can data be transfered from a device if it's never connected to other device.

There is a whole concept of air gap security, where a device is never connected to the internet or any other device, which is used in military, banking, and other high security sectors.

A device can connect to other through:

Fact 4

A device doesn't need to be connected to the internet or other device in order to do encryption or decryption.

Well this how encryption works, a device just need certain data like private key or a secret, you can even do this on a paper, but it's not practical.

Fact 5 (Encrypted data)

An encrypted message is okay to be transferd through a compromised device or to be leaked

Ultimatly, encryption main goal, is that anyone who get access wouldn't be able to decyprt it.

Note this is dones't go in odds with the first fcat, this because when we are using a device to transfer a cipher is totally different than when we use a device to encrypt a text a cipher, this very important to distigush between.

Well we have to agree on this point, the point of encryption is to make it impossibe to read to decrypt a cipher message without certian info like private key. So even if the message is intercepted by a malicious actor, it's still safe.

The whole cryptography is based on this fact, if don't agree with this fact, I can understand you. But I dpn't think there is a point to continue reading this guide. Nonethless I would welcome your suggestion.

There are cases where encrytion is broken but 95% of the time, the reason is an implementation error, not the encryption algorithm itself or the math behind is broken.

End of secion 1

Okay we got

Okay so far we can conculed, that all our devices are compromised, however if we disconnect those devices from the internet, we can safely perform encryption and decryption.

But how can an offline device recive or send an encrypted message if it's not connected to the internet or any other device?

So far we can conculde that if we can use a comproised device online device to share encrypted message, and comprpomised offline device to do the encryption and decryption.

But how to transfer an encrypted message from offline device to online device and vice versa?

This is the last part which is very important, and it's the reason why this method might not be practical for everyone.

There are three main options to transfer data from offline device to online device:

Put those facts togather, and you

In the digital age, we are constantly communicating through phones, computers, and other devices. While end-to-end encryption has become the gold standard for securing our communications, what happens if your device is compromised? Unfortunately, encryption alone cannot protect you if the device transmitting or receiving messages is under the control of a malicious actor.

Consider the following scenario: You rely on encrypted apps to communicate, but if your device is compromised, attackers could bypass encryption, monitor your activity, or steal sensitive information. This problem becomes especially acute for individuals in high-stakes situations, such as journalists, activists, or anyone handling confidential communications.

A Key Consideration

If the integrity of our devices cannot be trusted, how can we still ensure secure communication?


Section 2: a practial guide to communicate securely

Please note I am not a cypersecuirty expert, while I have been thinking, studying, and researching this topic for months..., even the most experienced cypersecurity/cryptography could and (offen do) make mistakes. You cannot imagine how a very simple/innocent mistake; could expose privacy or secuirty of millions of people!.

The main idea is simple, it's based on "air gapped" concept, where the device that does encrypting and decrypting is never connected to the internet or any other device.

The solution mainly is to use at offline device for cryptographic operations, and an online device communication. These devices never connect to the internet and are isolated from external interference. By making specific preparations and following strict guidelines, you can use such devices to send and receive encrypted messages securely.

Key Principles

  1. Air Gap: The device used for encryption/decryption must not connect to the internet or any other device under any circumstances.
  2. No Wireless Communication: Disable or physically remove all wireless communication components, such as Wi-Fi, Bluetooth, and NFC.
  3. Physical Security: Store the offline device in a secure location, and ensure it is protected from unauthorized access.
  4. Accept Usability Trade-Offs: Security and convenience are often at odds. This approach prioritizes security over ease of use.

Preparation and Communication Process

Preparation

Step 1: Have an offlice device

Step 2: Prepare the Offline Device

Operating System Free Tool
Windows Gpg4win (https://gpg4win.org/)
macOS GPG Suite (https://gpgtools.org/)
Linux GnuPG (pre-installed on most distributions)

[!CAUTION]
From this point on, the offline device should never connect to the internet. This is very important.

[!TIP]
From now on, I will assume your software of use is GPG suite for macOS, for demonstration purpose. But you should be replicate every step on any other.

Step 3: Generate key pairs

[!NOTE]
This step involves transfering data from offline device to online device, see offline to online guide below

[!TIP]
Before taking a screenshot of public key window, format the text with an OCR friendly font, I used Tahoma. in below screenshot

GPG Public Key scroonshot

Step 4: Import other people's public keys

[!NOTE]
This step involves transfering data from online device to offline device, see online to offline guide below

Communication Process

Step 5: Sending Messages/Encrypting Messages:

  1. Open TextEdit and write your message.
  2. Select the text and right click on it, select Services and then OpenPGP: Encrypt Selection
  3. Select the public key of the recipient.
  4. Now the text is encrypted, you can take photo of the encrypted text and send it to your friend or partner.

Step 6: Receiving Messages/Decrypting Messages:

  1. Transfer Encrypted Messages Offline:
    • The recipient’s online device captures the encrypted message and displays it.
    • Use the offline device to scan or type the encrypted message.
  2. Decrypt Messages:
    • Use the offline device and GPG with your private key to decrypt the message.
  3. Post-Decryption:
    • Delete sensitive decrypted messages after use. For important information, store it on paper instead of digitally.

Maintaining Offline Devices

Challenges:

  1. Updating Software:
    • If software updates are required, they must be downloaded on a separate device, verified for integrity, and transferred via trusted means (e.g., optical discs).
  2. Renewing Key Pairs:
    • Periodically generate new key pairs and securely share public keys.
  3. Data Transfers:
    • Avoid using USB drives, as they may carry malware.
    • Opt for manual methods such as OCR or visual transfer.

Final Considerations

Social Security

No matter how careful you were

Practicality vs. Security


By following these principles and processes, you can communicate securely even in an environment where online devices are compromised. While this method involves trade-offs between usability and security, it ensures that your sensitive communications remain protected from prying eyes.

Transferring text from offline device to online device and vice versa

Recall earlier, we said this method trade-off usability for security.
In this state, we have two devices in close proximity,

You have three main options to transfer data from offline device to online device[^what]:

  1. OCR - Optical Character Recognition, this invol[2]ves taking a photo of the text and usin[^hwww]g an OCR tool to extract the text.
  1. Manual Typing - This involves typing the text manually. Very time consuming
  2. QR Code - This involves converting the text to a QR code and scanning it with your online device.
    This probably the most starighforward method, the only disadvantage is that you would probably need to create multiple QR code for long text.

The don'ts:

Online to offline guide

Refs


  1. Zero Trust Architecture NIST Special publication 800-207 section 2.2.1 page 8 pdf version ↩︎

  2. https://github.com/ggerganov/ggwave ↩︎

  3. List of publicly known private companies which their whole business is to build software to spy people: https://xorl.wordpress.com. ↩︎

  4. https://stackoverflow.com/questions/316068/what-is-the-ideal-font-for-ocr ↩︎