Introduction The MPT protocol used to access files via USB on your phone is not that efficient. This post shows you an alternative to MTP for accessing your files on your mobile phone. It works by installilng an SSH server on your phone using Termux 1 and then use it to transfer files from and to your phone. This can be done either via the Wi-Fi network or by tunneling the SSH traffic through the…
Introduction This blogpost shows some useful configurations for the Mikrotik hAP ac² Wi-Fi router 1 . These profiles I used for testing purposes are different combinations between switching only, NAT routing, Wi-Fi and LTE by connecting a phone via USB. Product Information The Mikrotik hAP ac² router has 5 Gigabit Ethernet ports, one with PoE, Wi-Fi and USB for 3G/4G support. Technical details 2 :…
Introduction This post explains how you can manually open a LUKS encrypted logical volume, which can be useful if your encrypted system does not properly boot and you are trying to fix it from a live Linux or if you want to access an encrypted disk from another system. The following steps were performed using the live Linux Grml 1 on a system with LUKS full disk encryption that contains one volume…
Introduction There are a ton of ways to copy data between two systems. You can use a file sharing service on the Internet, transfer files via your self-hosted server or even use USB drives. This blog post shows a very simple and fast solution using IPv6 link-local addresses and a network cable. These link-local addresses allow you to communicate without the need of a router, Internet, static IP…
Introduction Last year, I bought the Birdie CO₂ monitor 1 to measure my CO₂ values at home. This air quality meter resembles a canary bird, referencing the days where canaries were used in coal mines to detect deadly carbon monoxide. When these stopped singing (or even collapsed 😥), this was a sign that the air quality was poor, and the workers needed to leave the mines 2 . This is how the Birdie…
Introduction I recently uploaded a file to a Nextcloud instance. After the upload, I saw that the file timestamp in Nextcloud is already some months old. But I just uploaded it, right? I double checked and saw that it matches the one on my local file system. How is this possible? Is a web application really able to read the last modification timestamp of the file? Apparently. I was not aware of…
Introduction In my last blog post ( Scanning for IP-Forwarding Systems / Routers ), I explained why it can be useful during pentests to identify IP-forwarding systems (also known as routers or gateways) and showcased a script that can be used to identify such systems. In this post, I’ll show how this can be done in IPv6 networks when your host has a routable IPv6 address configured. Script…
Introduction Systems which have IP forwarding or routing enabled (so called routers or gateways) will forward IP packets to other networks where the system is connected to. In pentests, it can be useful to search for such systems, because these systems could be used to access otherwise inaccessible networks and systems. I wrote a small script that automates this task. Script The script can be…
Introduction The last few days, I was at the GPN22 in Karlsruhe with some friends from our LuXeria hackerspace. We participated in the CTF . Here are the solutions I wrote for the challenges we solved together. So Many Flags Description I heard you like flags, so I launched Chrome with a lot of flags so you can get your flag! The flag is in /flag.txt , and the bot will visit the HTML file you…
Introduction Wireshark 4.2.0 added a new functionality [1] that can be used to directly launch a web browser with the SSLKEYLOGFILE environment variable set, in order to easily sniff and decrypt TLS traffic from a started application. Howto This new feature can be found in the Tools menu and then under TLS Keylog Launcher (1). You can specify to which file where the SSLKEYLOGFILE variable should…
Introduction X.509 certificates are used to secure communications online by encrypting data and verifying identities, such as in HTTPS or VPNs. During penetration tests, it’s important to check if systems correctly handle cloned certificates. Cloned certificates are fake copies that look like real ones but aren’t properly signed by a trusted CA. I wrote a simple python script called…
Introduction When you don’t have Internet connection during a web application pentest and you still want to install some BApps in the Burp Suite, you have to download them manually from the BApp Store . If you use a lot extensions, this can be a tedious task. It’s possible to download all BApps using a little script to simplify this task. Script The following script can be used to…
Introduction In pentests, connecting devices to your own network can be very useful. This enables you to exfiltrate data, download tools, analyze the network traffic and even use a transparent HTTP proxy to intercept and manipulate traffic between the devices and servers. This approach helps finding potential security weaknesses in applications and network communications. In order to make this…
Introduction Humble Book Bundle [1] has often very cool books about IT, hacking, security, programming, Linux, Unix, science and other geeky stuff. Sadly there is no reliable way to download all books. This post shows how you can download all books in a quick and reliable way using a bookmarklet. Precondition Of course, first you need to buy the Humble Book Bundle. For this example, I use the…
Introduction I was recently playing around with DNSSEC and figured out that the root DNS zone . uses NSEC and not NSEC3 to prove the absence of a resource record. This looked interesting to me and triggered some ideas. So I did some experiments and here are the results. TL;Dr: The most interesting facts: The root DNS zone uses NSEC can be therefore be DNSSEC zone walked There are more than 1500…
Introduction In pentests, you often need to create X.509 certificates (e.g. for TLS) or Certificate Authorities (CAs) to mimic secure environments during your tests. Manually generating these certificates with tools like openssl can be time-consuming and error-prone, especially when you’re in a hurry. Who remembers all these commands? Whether you’re setting up a fake webserver for data…
Introduction There was an advent calendar on http://xmas.rip/ that had a little network riddle every day: The riddles are very fun. I solved all except for the one on day 22. Here are my solutions. 1/TCP Day 1: Connect to port 1 using ncat and the -C option to send proper CRLF linebreaks. Sadly, the service does not support the HELP command that would output all services: $ ncat -C xmas.rip 1 HELP…
Introduction WireGuard is a relatively new open-source software for creating VPN tunnels on the IP layer using state of the art cryptography. I attended a self-organized session by the creator and developer Jason Donenfeld at the 34c3 who explained how WireGuard works and how it can be used. I was quite impressed by it’s simplicity and gave it a try. It worked more or less out of the box.…
Introduction The RFC 4648 (The Base16, Base32, and Base64 Data Encodings) defines different methods to encode binary data. Every Unix like system has the tool base64 installed to encode and decode data using the base64 alphabet. This alphabet includes the characters A-Z, a-z, 0-9, +, / for the data and = for padding. The base16 encoding scheme, better known as hex encoding, uses the alphabet 0-9…
Introduction If you take a photo with your Jolla phone, the date and time is not saved in the EXIF data. I like to have these data stored in my pictures, so they can easy be renamed. I wrote a script to add the date and time to the EXIF data based on the timestamp on the filesystem. Script The script does the following: Add the EXIF timestamp according to the filesystem timestamp Renames the photo…
Introduction This post describes an installation of Arch Linux with GPT (GUID partition table), LUKS (Linux Unified Key Setup) and LVM (Logical Volume Manager) with the basic graphical window manager i3. LVM is set up on top of LUKS. Systemd-boot is used as an EFI compatible boot manager. I wrote this post, so next time I don’t have to search all the information in the Arch Linux Wiki. For…
Einführung Jedes mal, wenn ich meine IP Adresse wissen will, gebe ich bei einer Suchmaschine “my ip address” ein und klicke auf eines der Ergebnisse. Dies ist nicht sehr elegant. Auf einem Server ohne Browser ist dies gar nicht möglich. Deshalb habe ich ein Script geschrieben, welches mir meine IP Adressen (IPv4 und IPv6) anzeigt. Script Das Script sieht folgenermassen aus:…
Einführung Hier wird ein Setup von GnuPG beschrieben, welches den privaten Teil vom Primary Key auf einem verschlüsselten USB Stick offline speichert. Dies hat folgende Vorteile: Wird in das System eingebrochen, hat der Angreifer nur Zugriff auf die Subkeys und nicht auf den Primary Key. Dann muss man nicht alle Keys widerrufen, sondern nur die Subkeys. Dies hat bedeutet, dass die vorhandenen Key…
Für Mobiltelefone gibt es Barcode/QR-Code Scanner wie Sand am Meer. Für Linux auf dem Desktop jedoch nicht. Deshalb bastelte ich mir ein kleines Script, damit ich aus der Bash QR-Codes scannen kann. Das Script baut auf den Tools scrot und zbar auf. QR-Code Abfotografieren Mit maim kann man Screenshots machen. Entweder klickt man in ein Fenster oder man zieht (mit derm Schalter -s ) ein Range auf,…
Einführung Verbindet man sich zum ersten Mal per SSH mit einem Server, sieht man den Fingerabdruck des Servers. Diesen sollte man im Idealfall vergleichen und erst mit yes bestätigen, wenn man sich sicher ist, dass es sich um den richtigen Fingerprint handelt. Stimmt der Fingerabdruck nicht, könnte man Opfer einer Man in the Middle Attacke sein. Das Vergleichen der Fingerprints ist etwas mühsam…
Einführung Setzt man DNSSEC ein, muss man bei jeder Änderung der Zone oder wenn die Signatur abgelaufen ist die Zone neu signieren. Setzt man dynamisches DNS ein (wie in diesem Blogpost beschrieben: Eigener Dynamischen DNS (DDNS) Service betreiben (Eigenes DynDNS) , ist es am einfachsten wenn der Nameserver die Zone nach einem Update selber neu signiert. Das Problem Es gibt den Host…
Einführung DNS Antworten können signiert werden, damit man überprüfen kann, ob es sich um eine richtige und vertrauenswürdige Antwort handelt. Die DNS Antworten werden vom authoritativen DNS Server signiert. Die Schlüssel, welche die Antworten signieren, werden von dem DNS Server eine Zone höher signiert. Über diese Chain-of-Trust können Anwendungssoftware und DNS Resolver prüfen, ob eine Antwort…
Einführung SSH kann dazu verwendet werden, Ports von und zu anderen Geräten weiterzuleiten. So kann zum Beispiel via SSH auf eine Datenbank auf einem Server zugegriffen werden, welche sonst nur Verbindungen von sich selber akzeptiert. Ein anderer Anwendungsfall wäre die Bereitstellung eines Dienstes in einem Netzwerk, welches die Clients im Netz wo der Server steht sonst keinen Zugriff hätte. Dies…
Einführung Manche Dienste will man nur für bestimmte Geräte zugänglich machen. Befindet sich der Server und der Client im selben Layer 2 Netz, ist es einfach die Verbindungen nur für bestimmte MAC-Adressen zuzulassen. Kommt die Verbindung nicht von der konfigurierten MAC-Adresse, wird der Verbindungsaufbau nicht zugelassen und der Dienst ist für dieses Gerät somit nicht verfügbar. Mein…
Einführung Mit iptables kann man unter Linux eine Firewall konfigurieren. In diesem Artikel zeige ich die wichtigsten Befehle und Arbeitsschritte um eine Firewall für IPv4 und IPv6 einzurichten. Hilfsvariabeln und Hilfsfunktionen Folgende Hilfsvariabeln vereinfachen einem die Kontrolle über de einzelnen Befehle und Konfigurationsdateien: IPTABLES = '/sbin/iptables' IPTABLES_SAVE =…
Einführung Für mich ist es wichtig, dass Fotos mit einem korrekten Zeitstempel versehen sind. Falls ein Bild noch kein EXIF Zeitstempel besitzt, kann man den mit jhead einfach hinzufügen. Foto mit Zeitstempel versehen Zuerst muss eventuell noch der EXIF Header dem Foto hinzugefügt werden: $ jhead -mkexif foto.jpg Danach kann man mit der Option -ds von jhead das Aufnahmedatum in der Form yyyy:mm:dd…
Einführung Wenn man Fotos von mehreren Kameras zusammenführen will, ist es von Vorteil, wenn das Aufnahmedatum auf die Sekunde genau stimmt. Es kann auch sein, dass die Kamera während den Ferien in der falschen Zeitzone war oder noch auf Winterzeit eingestellt war. Mit jhead kann man das Aufnahmedatum von Fotos korrigieren. Referenzzeit fotografieren Als erstes braucht man eine Referenzzeit. Dazu…
Einführung Mit Dynamischem DNS (DDNS) kann man DNS Einträge zur Laufzeit verändern. So kann z. B. ein DHCP Server autoomatisch zu jedem DHCP Client ein DNS Eintrag erstellen. Ein anderer Anwendungszweck ist das bereitstellen eines DNS-Eintrags (z. B. A oder AAAA Records) für eine sich oft wechselnde IP-Adresse, damit diese immer unter dem selben Namen erreichbar ist. Bekannte Anbieter solcher…
Einführung In den letzten zwei Wochen habe ich mich auf die CCNA Prüfung vorbereitet (und erfolgreich bestanden ;-)). Dabei sind diese Notizen entstanden. Vielleicht kann diese jemand gebrauchen (Fehler sind jedoch nicht ausgeschlossen, da es sich legidlich um meine persönlichen Notizen handelt). Die ganze Zusammenfassung ist auch als PDF verfügbar: Cisco Certified Network Associate (CCNA)…
Einführung Ich muss oft Zahlen von einem Zahlensystem in ein anderes umwandeln. Für kleine Zahlen und bekannte Basen geht das noch im Kopf, aber wenn man viele oder grosse Zahlen umwandeln will, nimmt man gerne die Hilfe eines Computers entgegen. Damit ich nicht auf eine Internetverbindung und ein Onlinetool angewiesen bin, entwickelte ich ein kleines Script, welches Zahlensysteme für mich…
Einführung Seit kurzer Zeit muss man sich, damit man seinen Hostnamen nicht verliert, jeden Monat im Account von DynDNS.org einloggen. Mit einem einfachen Skript und einem Crontab Eintrag lässt sich das automatisieren. Automatisch einloggen Folgendes Skript automatisiert das Login im Account von DynDNS.org. Man muss nur noch den Usernamen und das Passwort eintragen. #!/usr/bin/env bash # #…
Einführung Damit ich am Morgen von passender Musik geweckt werde, habe ich mir ein Skript geschrieben, welches mein Notebook in einen Wecker verwandelt. So stelle ich normalerweise den Notebook vor dem Schlafen gehen in den Sleep-Modus, welcher 30 Minuten Musik abspielt und danach in den Stanbdy fährt. Am Morgen schaltet mein Notebook automatisch zur eingestellten Weckzeit ein und spielt die Musik…
Einführung Mit tmux kann man wie mit screen mehrere Terminalfenster innerhalb einer Konsole verwalten. tmux hat jedoch ein paar Vorteile gegenüber dem Klassiker screen . Vorteile von tmux gegenüber screen Fenster können auch vertikal gesplittet werden Visuelle Benachrichtigung bei Aktivitäten aus anderem Fenster Mehr Konfigurationsoptionen Einfachere Konfiguration als (vgl. hardstatusstring von…
Einführung Seit Arch Linux komplett auf systemd umgestellt hat, gibt es die Datei /etc/rc.local nicht mehr. Will man trotzdem Befehle direkt beim Systemstart ausführen, kann man sich einen systemd Service schreiben. Service schreiben Services unter systemd sind viel einfacher aufgebaut, als die Startskripte unter SysVinit . Die Services (egal ob aktiviert oder nicht), liegen im Verzeichnis…
Einführung Mit screen kann man mehrere Fenster innerhalb eines Terminals verwalten. In der Standardkonfiguration ist screen jedoch nicht optimal für das tägliche Arbeiten konfiguriert. Ich habe screen so eingerichtet, dass z. B. die Willkommensnachricht nicht erscheint und dass am unteren Bildschirmrand eine Leiste mit allen offenen Fenster angezeigt wird. Konfiguration Mit der Datei .screenrc ,…
Einführung Mit screen kann man mehrere Fenster innerhalb eines Terminals verwalten. So kann man innerhalb eines Terminalfensters zwischen mehreren Fenster umschalten und so z. B. auf einem entfernt gelegenen Server mehrere Shells in nur einer SSH-Verbindung nutzen. Grundlegende Aufgaben mit Fenster Das sind die grundlegenden Funktionen, um mit screen zu arbeiten. C-a bedeutet Control + A Taste.…
Einführung Mit conky kann man ganz einfach auf dem Desktop Informationen zum System anzeigen lassen. So zum Beispiel der Hostname, die CPU-Auslastung, Memoryverbrauch, Dateisysteme, abgespielte Musik, Netzwerkkonfigurationen und noch viel mehr. Konfiguriert wird conky in der Konfigurationsdatei ~/.conkyrc . Meine Konfiguration Ich habe im Internet viele conky -Konfigurationen gesehen und mir mit…
Einführung Viele Funktionen vom klassischen vi Editor lassen sich auch in anderen Programmen nutzen. Den vi Mode Aktivieren In der Shell (ksh, bash, zsh, …) In der Shell (Korn Shell, Bash, Z Shell, …) kann man mit folgendem Befehl den vi Modus aktivieren: $ set -o vi Damit dies direkt beim Start aktiviert wird, fügt man folgende Zeile in der RC-Datei der Shell ein: set -o vi In der…
Einführung Manche Digitalkameras können Fotos in einem bestimmten Zeitintervall auslösen. Nach ein paar Stunden sammeln sich viele Fotos in einem Ordner an, welche man mit ffmpeg in ein Video umwandeln kann. Ich habe einige Zeit gebraucht, bis alles endlich funktioniert hat. Hier seht ihr, wie man das mit ffmpeg machen kann. Schritt für Schritt Ausgangslage Als Ausgangslage habe ich viele Fotos in…
Einführung An einem Computer oder Notebook angeschlossene Bildschirme kann man sehr einfach mit dem Tool xrandr verwalten und steuern. Dabei kann man z. B. den Bildausschnitt oder die Auflösung festlegen. Dieser Artikel gilt für Bildschirme wie auch für Beamer. Bildschirme erkennen Mit folgendem Befehl kann man feststellen, welche Bildschirme einem zur Verfügung stehen und wie die aktuelle…
Einführung Auf einem Notebook sind oft private Daten, welche nicht in andere Hände geraten sollen. Deshalb habe ich mein Notebook komplett verschlüsselt. Ich muss mir dann keine Gedanken machen, wenn ich mein Notebook verliere oder es gestohlen wird. Diese Installation legt Logical Volumes auf einer mit LUKS verschlüsselten Partition an. Ist mein Notebook dafür geeignet? Neuere Prozessoren…
Einführung Standardmässig verschlüsselt man heutzutage sein WLAN mit WPA2 PSK. Mit wpa_supplicant kann man sich an diesem WLAN authentifizieren. Die Konfigurationsdatei dafür wird mit wpa_passphrase generiert. WLAN Netzwerk finden Zuerst wird das WLAN-Interface aktiviert (in meinem Fall heisst das Interface wlan0 ): $ sudo ifconfig wlan0 up Dann scannt man nach verfügbaren Netzwerken: $ sudo…
Einführung In VI kann man eine oder mehrere Zeilen kopieren oder ausschneiden und diese in Register ablegen. Auf diese Register kann man dann später zugreifen und so den Text wieder einfügen. Syntax Die Befehle beginnen mit einem Anführungszeichen ( " ) gefolgt von einem Buchstaben. Dieser Buchstabe ist der Name vom Register. Danach kommt der eigentliche Befehl von VI. "add : Löscht die aktuelle…
Einführung VIM kann Dateien in Tabs darstellen. Dies ist sehr praktisch, wenn man mehrere Files gleichzeitig in einem Fenster bearbeiten und zwischen den einzelnen Dateien hin- und her wechseln will. Befehle Folgende Befehle sollte man in VIM kennen, um mit Tabs zu arbeiten: $ vim -p foo.tex bar.tex : Öffnet die zwei Files foo.tex und bar.tex mit VIM in Tabs :tabe : Neues File in neuem Tab öffnen…