Thursday, January 11, 2024

How Johnny Can Persuade LLMs to Jailbreak Them: Rethinking Persuasion to Challenge AI Safety by Humanizing LLMs

 This project is about how to systematically persuade LLMs to jailbreak them. The well-known "Grandma Exploit" example is also using emotional appeal, a persuasion technique, for jailbreak!

What did we introduce? A taxonomy with 40 persuasion techniques to help you be more persuasive!

What did we find? By iteratively applying diffrent persuasion techniques in our taxonomy, we successfully jailbreak advanced aligned LLMs, including Llama 2-7b Chat, GPT-3.5, and GPT-4 — achieving an astonishing 92% attack success rate, notably without any specified optimization.

Now, you might think that such a high success rate is the peak of our findings, but there's more. In a surprising twist, we found that more advanced models like GPT-4 are more vulnerable to persuasive adversarial prompts (PAPs). What's more, adaptive defenses crafted to neutralize these PAPs also provide effective protection against a spectrum of other attacks (e.g., GCG, Masterkey, or PAIR). read more....

Friday, December 29, 2023

What Every Developer Should Know About GPU Computing.

 Most programmers have an intimate understanding of CPUs and sequential programming because they grow up writing code for the CPU, but many are less familiar with the inner workings of GPUs and what makes them so special. Over the past decade, GPUs have become incredibly important because of their pervasive use in deep learning. Today, it is essential for every software engineer to possess a basic understanding of how they work. My goal with this article is to give you that background. read more...

Tuesday, November 21, 2023

The Python Rich Package: Unleash the Power of Console Text.

 

Python’s Rich package is a tool kit that helps you generate beautifully formatted and highlighted text in the console. More broadly, it allows you to build an attractive text-based user interface (TUI).

Why would you choose a TUI over a graphical user interface, or GUI? Sometimes a text display feels more appropriate. Why use a full-blown GUI for a simple application, when an elegant text interface will do? It can be refreshing to work with plain text. Text works in almost any hardware environment, even on an SSH terminal or a single-board computer display. And many applications don’t need the complexity of a full graphical windowing system. read more...

Saturday, September 23, 2023

Writing a systemd Service in Python

 Many Linux distributions use systemd to manage the system's services (or daemons), for example to automatically start certain services in the correct order when the system boots.

Writing a systemd service in Python turns out to be easy, but the complexity of systemd can be daunting at first. This tutorial is intended to get you started.

When you feel lost or need the gritty details, head over to the systemd documentation, which is pretty extensive. However, the docs are distributed over several pages, and finding what you're looking for isn't always easy. A good place to look up a particular systemd detail is systemd.directives, which lists all the configuration options, command line parameters, etc., and links to their documentation. continue reading...

Thursday, September 07, 2023

Analyse der aktuellen Cybersicherheitslage:

1-  Untersuche die aktuelle Bedrohungslage im Cyberraum deines Landes. 

Bewerte die Schwachstellen und Herausforderungen im Bereich der Cybersicherheit, 

insbesondere im Hinblick auf Kritische Infrastrukturen.


- Die Zahl der bekannten Schwachstellen in Software-Produkten ist im Jahr 2021 um zehn Prozent gestiegen, mehr als die Hälfte davon waren hoch oder kritisch.


- Die häufigsten Cyberangriffe auf Deutschland waren Ransomware, Phishing, DDoS und Spionage.


- Die am stärksten betroffenen Sektoren waren Gesundheit, Verwaltung, Energie und Bildung.


- Die wirtschaftlichen Schäden durch Cyber-Vorfälle werden auf mehrere Milliarden Euro pro Jahr geschätzt.


- Die Cybersicherheitsbewusstsein in der Bevölkerung und in Unternehmen ist noch verbesserungswürdig.


- Die Zusammenarbeit zwischen staatlichen und privaten Akteuren sowie internationalen Partnern wurde verstärkt, insbesondere durch das IT-Sicherheitsgesetz 2.0.


Wenn Sie mehr Details erfahren möchten, können Sie die folgenden Links besuchen:

(1) BSI - Die Lage der IT-Sicherheit in Deutschland. https://www.bsi.bund.de/DE/Service-Navi/Publikationen/Lagebericht/lagebericht_node.html.

(2) Die Lage der IT-Sicherheit in Deutschland 2021. https://www.bsi.bund.de/SharedDocs/Downloads/DE/BSI/Publikationen/Lageberichte/Lagebericht2021.pdf?__blob=publicationFile&v=3.

(3) BSI - Aktuelle Themen und Vorfälle. https://www.bsi.bund.de/DE/Themen/Verbraucherinnen-und-Verbraucher/Cyber-Sicherheitslage/cyber-sicherheitslage_node.html.


2- Taktiken und Techniken: Untersuchen Sie die Taktiken und Techniken, die von Bedrohungsakteuren eingesetzt werden, wie Malware, Phishing, Ransomware und fortgeschrittene andauernde Bedrohungen (APTs).

- **Malware:** Schadsoftware, die heimlich auf dem Computer oder Netzwerk des Opfers installiert wird, um Daten zu stehlen, Schaden anzurichten oder die Kontrolle zu übernehmen. Beispiele sind Viren, Würmer, Trojaner und Spyware¹².


- **Phishing:** Betrügerische E-Mails, die vorgeben, von einer vertrauenswürdigen Quelle zu stammen, um das Opfer dazu zu bringen, persönliche Informationen preiszugeben oder auf einen bösartigen Link oder Anhang zu klicken. Beispiele sind gefälschte Rechnungen, Gewinnbenachrichtigungen oder Sicherheitswarnungen¹²³.


- **Ransomware:** Eine Art von Malware, die die Daten oder Systeme des Opfers verschlüsselt und Lösegeld für die Entschlüsselung verlangt. Beispiele sind WannaCry, CryptoLocker und Locky¹².


- **Advanced Persistent Threats (APTs):** Langfristige und gezielte Angriffe von hochqualifizierten und motivierten Angreifern, die versuchen, in das Netzwerk des Opfers einzudringen und dort unbemerkt zu bleiben. Beispiele sind staatlich geförderte Spionage, Sabotage oder Diebstahl von geistigem Eigentum¹².


Wenn Sie mehr Details erfahren möchten, können Sie die folgenden Links besuchen:

(1) Was sind Cyber-Bedrohungsakteure und warum sind sie schlecht? von .... https://de.vectra.ai/blogpost/identifying-cyber-enemies.

(2) Cyber-Bedrohungsakteure − Motive und Taktiken: Modul 2. https://easydmarc.com/blog/de/cyber-bedrohungsakteure-%E2%88%92-motive-und-taktiken-modul-2/.

(3) Cyber-Bedrohungsakteure und ihre Angriffsmethoden: Modul 1. https://easydmarc.com/blog/de/cyber-bedrohungsakteure-und-ihre-angriffsmethoden-modul-1/.


3- Schwachstellen in kritischen Infrastrukturen in Deutschland, basierend auf den Informationen, die ich gefunden habe.


- **Stromnetze:** Die Stromversorgung ist essentiell für viele andere kritische Infrastrukturen wie Kommunikation, Verkehr oder Gesundheit. Schwachstellen sind unter anderem die Abhängigkeit von ausländischen Stromlieferanten, die Anfälligkeit für Naturkatastrophen oder Cyberangriffe und die Herausforderungen der Energiewende¹².


- **Wasserversorgung:** Die Wasserversorgung ist lebenswichtig für die Bevölkerung und die Landwirtschaft. Schwachstellen sind unter anderem die Alterung der Wasserinfrastruktur, die Gefahr von Kontaminationen oder Sabotage und der Klimawandel¹².


- **Verkehrssysteme:** Die Verkehrssysteme sind wichtig für die Mobilität, den Handel und die Logistik. Schwachstellen sind unter anderem die Überlastung der Verkehrswege, die Abhängigkeit von fossilen Brennstoffen und die Digitalisierung der Verkehrstechnik¹².


- **Digitale Kommunikationsnetze:** Die digitalen Kommunikationsnetze sind grundlegend für die Informationsgesellschaft, die Wirtschaft und die Verwaltung. Schwachstellen sind unter anderem die Komplexität der Netzwerke, die Vielzahl der Akteure und die steigende Zahl und Qualität von Cyberangriffen¹².


Die Bereitschaft zur Abwehr von Cyberangriffen auf diese lebenswichtigen Systeme wurde durch das IT-Sicherheitsgesetz 2.0 verbessert, das im Dezember 2022 in Kraft getreten ist. Das Gesetz sieht unter anderem vor, dass Betreiber kritischer Infrastrukturen höhere Sicherheitsstandards einhalten, Sicherheitsvorfälle melden und regelmäßig Sicherheitsaudits durchführen müssen³.


(1) BMI - Alle Schwerpunkte - Schutz Kritischer Infrastrukturen in Deutschland. https://www.bmi.bund.de/SharedDocs/schwerpunkte/DE/schutz-kritis/topthema-kritis.html.

(2) KRITIS-Gefahren - BBK. https://www.bbk.bund.de/DE/Themen/Kritische-Infrastrukturen/KRITIS-Gefahrenlagen/kritis-gefahrenlagen_node.html.

(3) Bundesregierung beschließt besseren Schutz Kritischer Infrastrukturen. https://www.bmi.bund.de/SharedDocs/kurzmeldungen/DE/2022/12/kritis-dachgesetz.html.

Schwachstellen-Scanning: Bedeutung und Prozess

 Schwachstellen-Scanning: Bedeutung und Prozess


Schwachstellen-Scanning ist ein kritischer Schritt in der Informationssicherheit, der dazu dient, potenzielle Sicherheitslücken in Computersystemen, Netzwerken und Anwendungen zu identifizieren. Dieser Prozess ermöglicht es Organisationen, ihre digitalen Assets vor Angriffen und Datenlecks zu schützen, indem sie bekannte Schwachstellen identifizieren und beheben, bevor Angreifer diese ausnutzen können.


Bedeutung von Schwachstellen-Scanning:


1. Risikominderung: Durch das regelmäßige Scannen von Systemen können Schwachstellen frühzeitig erkannt und behoben werden, um das Risiko von Sicherheitsverletzungen zu minimieren.

2. Compliance: Viele branchenspezifische Vorschriften und Standards erfordern regelmäßige Schwachstellen-Scans, um sicherzustellen, dass Organisationen die erforderlichen Sicherheitsstandards einhalten.

3. Kostenersparnis: Die Behebung von Schwachstellen, bevor sie ausgenutzt werden, ist kostengünstiger als die Bewältigung der Folgen eines Sicherheitsvorfalls.


Prozess des Schwachstellen-Scannings:


1. Vorbereitung: Identifiziere die zu scannenden Systeme und Netzwerke, erstelle eine Liste der zu verwendenden Tools und stelle sicher, dass du die notwendigen Berechtigungen und Genehmigungen hast.

2. Scanning: Führe die Schwachstellen-Scans mithilfe der ausgewählten Tools durch. Dies kann automatisiert oder manuell erfolgen, abhängig von den Anforderungen und Ressourcen.

3. Identifikation: Analysiere die Scan-Ergebnisse, um Schwachstellen zu identifizieren. Priorisiere sie nach ihrer Schwere, um die dringendsten Probleme zuerst anzugehen.

4. Berichterstattung: Erstelle einen Bericht, der die identifizierten Schwachstellen, deren Schweregrad und Empfehlungen zur Behebung enthält.

5. Behebung: Behebe die gefundenen Schwachstellen gemäß den Prioritäten. Verifiziere anschließend, ob die Schwachstellen erfolgreich behoben wurden.

6. Wiederholung:  Führe regelmäßige Schwachstellen-Scans durch, um sicherzustellen, dass neue Schwachstellen nicht auftreten und bekannte Schwachstellen behoben bleiben.


Hypothetischer Plan für ein Schwachstellen-Scanning-Projekt:


Ziel: Schwachstellen-Scanning für das interne Netzwerk einer mittelgroßen Organisation.


Vorgehensweise:

1. Systeme und Netzwerke: Scannen des internen Netzwerks, einschließlich Server, Workstations und Netzwerkkomponenten.

2. Tools: Verwenden von OpenVAS für das automatisierte Scanning und Nessus für die manuelle Überprüfung kritischer Systeme.

3. Genehmigungen: Sicherstellen, dass alle notwendigen Genehmigungen von den Verantwortlichen der Systeme und der IT-Abteilung eingeholt wurden.

4. Scanning: Planen Sie regelmäßige Scans, die außerhalb der Arbeitszeiten durchgeführt werden, um die Produktivität nicht zu beeinträchtigen.

5. Identifikation: Analysieren der Scan-Ergebnisse und Priorisieren der Schwachstellen nach ihrem Risikograd.

6. Berichterstattung: Erstellen eines detaillierten Berichts, der alle gefundenen Schwachstellen und Empfehlungen zur Behebung enthält.

7. Behebung: Beheben der Schwachstellen entsprechend der Prioritäten und Überprüfen der erfolgreichen Behebung.


8. Wiederholung: Planen regelmäßiger Scans (z.B. monatlich) und kontinuierliche Überwachung der Sicherheitslage.


Rechtliche und ethische Aspekte:


- Compliance: Sicherstellen, dass das Scanning den geltenden Gesetzen und Vorschriften entspricht.

- Datenschutz: Schutz sensibler Daten während des Scan-Prozesses und bei der Berichterstattung.

- Zustimmung: Einholen der Zustimmung der betroffenen Mitarbeiter und Benutzer, da das Scannen ihre Privatsphäre beeinträchtigen kann.

- Verantwortung: Sicherstellen, dass die gefundenen Schwachstellen verantwortungsvoll behandelt und behoben werden, um das Risiko für die Organisation und ihre Kunden zu minimieren.


Schwachstellen-Scanning ist ein entscheidender Bestandteil der Informationssicherheit und erfordert sorgfältige Planung, Durchführung und Berücksichtigung rechtlicher und ethischer Aspekte, um erfolgreich zu sein.

Wednesday, August 30, 2023

Scapy - Python Scripting with Scapy.

Scapy is a powerful and flexible Python-based interactive packet manipulation tool and network protocol scanner. It allows you to craft, send, receive, and manipulate network packets at a low level. Scapy is often used for network analysis, testing, and penetration testing, as it provides the capability to create custom packets and interact with network protocols in a way that is not easily achievable with standard networking libraries.


Key features of Scapy include:


1. **Packet Creation and Manipulation:** Scapy allows you to create and customize network packets from scratch. You can define various packet fields, headers, and payloads to craft packets tailored for specific purposes.


2. **Packet Sending and Receiving:** Scapy enables you to send and receive packets over a network interface. You can send crafted packets to a target and capture packets from the network, which is useful for analyzing network traffic.


3. **Packet Sniffing:** Scapy can capture and display live network traffic, making it useful for analyzing network communication and identifying potential security vulnerabilities.


4. **Protocol Support:** Scapy supports a wide range of network protocols and allows you to work with both common and custom protocols. This versatility makes it a valuable tool for network research and analysis.


5. **Network Exploration and Security Testing:** Scapy can be used for security testing and penetration testing. It can help identify network weaknesses and vulnerabilities by sending custom packets and observing the responses.


6. **Interactive Shell:** Scapy provides an interactive shell that allows you to experiment with packet creation, manipulation, and network interaction in real-time.


7. **Scripting and Automation:** Scapy can be scripted to automate various network-related tasks, such as network discovery, testing, and troubleshooting.


While Scapy is a powerful tool, it's important to note that it operates at a low level and requires a good understanding of networking protocols to use effectively. It's commonly used by network administrators, security professionals, and researchers who need granular control over network interactions and packet analysis.

This lab aims to learn how we use Scapy and python to programme the network monitor tools (manipulating, sending, receiving and sniffing packets

Sunday, July 16, 2023

Unlock IPython's Magical Toolbox for Your Coding Journey.

When you’re executing Python code, the standard Python shell that comes with your Python installation is a natural tool to use. However, as you progress in your coding journey, you might find yourself seeking more powerful functionalities than the standard REPL offers. Luckily, IPython offers an enhanced version of interactive Python that can supercharge your capabilities.

Using the IPython shell is a fast way of learning Python and executing code without the need for a full-fledged integrated development environment (IDE), such as PyCharm. IPython adds great features to the Python experience with its magic commands, which the standard Python shell lacks. These can help you complete tasks more quickly.

In this tutorial, you’ll:

  • Learn the major aspects and functionality of the IPython shell
  • Write and execute code in IPython
  • Integrate IPython in your Python scripts
  • Use IPython’s magic commands in your coding sessions
  • Learn how to save your sessions persistently in a Python file

To get started with IPython, you don’t need to be far along in your Python journey. In fact, IPython is an excellent learning tool because it offers an intuitive interface. Are you ready to get started?

 

Sunday, June 18, 2023

Enum4linux: Unveiling Windows System Details with Essential Commands

Introduction:

In the realm of ethical hacking and penetration testing, Enum4linux stands as a powerful tool for gathering information and enumerating data in Windows environments. This article delves into Enum4linux, highlighting its features, benefits, and best practices, while showcasing essential commands to maximize its effectiveness.


Understanding Enum4linux:

Enum4linux is an open-source tool specifically designed for enumerating Windows and Samba systems. It empowers penetration testers and security professionals by extracting valuable information, aiding in vulnerability assessment, privilege escalation, and reconnaissance efforts.


Key Features and Benefits:

1. User Enumeration:

Command: `enum4linux -U <target_IP>`

This command enumerates user accounts on the target Windows system, providing insights into available accounts, user IDs, full names, and group memberships. Understanding user accounts assists in assessing the potential attack surface and identifying weak points.


2. Share Enumeration:

Command: `enum4linux -S <target_IP>`

By running this command, Enum4linux enumerates shared resources (shares) on Windows and Samba systems. It identifies accessible file shares, examines their permissions, and determines whether sensitive data might be exposed or misconfigured.


3. Password Policy Extraction:

Command: `enum4linux -P <target_IP>`

This command extracts the password policy settings of the Windows system, providing details like password complexity requirements, lockout policies, and password age limits. Understanding these policies helps assess the strength of the authentication mechanism and advise on improvements if necessary.


4. Enumerating Group Memberships:

Command: `enum4linux -G <target_IP>`

Executing this command retrieves group membership information from the target Windows system. It provides visibility into which users belong to specific groups, aiding in the identification of potential high-privileged accounts or targets for privilege escalation.


Best Practices for Using Enum4linux:

1. Obtain Proper Authorization:

Ensure you have legal authorization and appropriate permissions before using Enum4linux or any enumeration tool. Unauthorized or malicious use can lead to legal consequences.


2. Use Enum4linux in Controlled Environments:

Perform enumeration in controlled lab environments or authorized production environments. Avoid using it on systems that do not belong to you or without proper consent.


3. Documentation and Consent:

Maintain records of systems you intend to enumerate and seek explicit consent from system owners or stakeholders. Document the purpose, scope, and timeframe of your enumeration activities.


4. Stay Updated:

Regularly update Enum4linux to benefit from the latest bug fixes, improvements, and features. Check for new releases or community-supported versions on reputable platforms or the official Enum4linux repository.


5. Analysis and Reporting:

After using Enum4linux, carefully analyze the gathered information and compile a comprehensive report. Highlight potential vulnerabilities, misconfigurations, or areas for further investigation. Share the report with relevant stakeholders, providing recommendations for improving system security.


Conclusion:

Enum4linux serves as a powerful tool for enumerating Windows and Samba systems, revealing critical information about user accounts, shared resources, password policies, and group memberships. By employing the provided commands and adhering to best practices, security professionals can effectively utilize Enum4linux to assess vulnerabilities, recommend security enhancements, and fortify the overall security posture of Windows environments. Responsible and ethical usage remains paramount in maintaining trust and ensuring a secure digital landscape.

Nmap and 12 useful NSE scripts.

Nmap is the most popular free security scanner developed by Gordon Lyon (f.f. Fyodor Vaskovich). The first version of Nmapa was published on October 1, 1997, in the online magazine, Phrack.

For those interested in the beginnings of this scanner, here is a full article that shows the capabilities and source code of the first version of Nmap: The Art of Port Scanning.

At the time of writing this text, the latest version of Nmap is 7.70. This version is equipped with 588 NSM scripts (Nmap Scripting Engine), which, along with a huge number of standard scanning options, give the opportunity to examine more carefully the hosts we are interested in.

NSE can be used, among others, to more accurately detect the version of a given service, break usernames and passwords, detect and use known vulnerabilities, and even detect existing back gates left by the attacker and fuzzing.

A list of all available scripts with descriptions is published at https://nmap.org/nsedoc/. Alternatively, to get a list, we can use the terminal (assuming that Nmap has been installed in the default location): read more....

Wednesday, May 17, 2023

Introduction to Netcat (nc).

The Swiss Army Knife for Networking.

In the realm of networking tools, few are as versatile and powerful as Netcat (or `nc`). Netcat is often dubbed the "Swiss Army Knife for Networking" due to its ability to perform a wide range of network-related tasks. It serves as a feature-rich utility that enables users to establish connections, send and receive data, and act as a network server or client. Let's dive into the features and usage of Netcat.
 

Basic Netcat Features:

1. **Port Scanning**: Netcat can be used to scan ports on a remote host to determine which ports are open and accepting connections. This feature is particularly useful for network administrators and security professionals.

2. **Data Transfer**: Netcat allows for bidirectional data transfer between network hosts. It can be used to send and receive files, stream data, or even create basic chat applications.

3. **Network Proxy**: Netcat can act as a simple network proxy, allowing you to relay connections between two hosts. This can be helpful for debugging, testing, or accessing restricted resources.

4. **Banner Grabbing**: With Netcat, you can retrieve the banners sent by services running on remote hosts. Banners often contain valuable information about the remote service, aiding in reconnaissance or vulnerability assessment.

5. **Remote Shell**: Netcat can facilitate remote command execution, enabling you to execute commands on a remote host and receive the output on your local machine.
 

Using Netcat:

Netcat operates using a command-line interface, providing a set of options and parameters to configure its behavior. Here are some common use cases and commands to get you started:

1. **Establishing Connections**:

   - To connect to a remote host on a specific port:
     ```
     nc <hostname> <port>
     ```

   - To listen on a specific port for incoming connections:
     ```
     nc -l <port>
     ```

2. **Data Transfer**:

   - To send a file to a remote host:
     ```
     nc <hostname> <port> < <file>
     ```

   - To receive a file from a remote host:
     ```
     nc -l <port> > <file>
     ```

3. **Port Scanning**:

   - To scan a range of ports on a remote host:
     ```
     nc -z <hostname> <start_port>-<end_port>
     ```

   - To scan a single port on multiple hosts:
     ```
     nc -zv <host1> <port> <host2> <port> ...
     ```

4. **Remote Shell**:

   - To execute commands on a remote host and display the output locally:
     ```
     nc <hostname> <port> -e /bin/bash
     ```

5. **Proxying Connections**:

   - To relay connections between two hosts:
     ```
     nc -l <port> | nc <destination_host> <destination_port>
     ```

These examples provide a glimpse into the possibilities offered by Netcat. However, please note that Netcat has extensive options and variations for each use case. To explore the complete set of features and options, refer to the Netcat manual page by running `man nc` in your terminal.
 

Closing Thoughts:

Netcat's simplicity, flexibility, and vast capabilities make it an invaluable tool for network administrators, security professionals, and enthusiasts alike. Its ability to handle various network tasks, coupled with its lightweight nature, has cemented its status as a go-to utility in the realm of networking.

Whether you need to transfer files, probe for open ports, create network servers or clients, or perform advanced network operations, Netcat provides a reliable and efficient solution. With practice and exploration, you can unlock even more of Netcat's potential.

So, unleash the power of Netcat, experiment with its features, and discover how it can simplify your network-related tasks!

How Johnny Can Persuade LLMs to Jailbreak Them: Rethinking Persuasion to Challenge AI Safety by Humanizing LLMs

  This project is about how to systematically persuade LLMs to jailbreak them. The well-known ...