Skip to content
KitploitKITPLOIT
ToolsBlog
Einreichen
ToolsBlog
Einreichen

Hacking-, PenTest- und Cybersicherheits-Tools für Ihr Sicherheitsarsenal!

Kitploit ist ein Verzeichnis von Hacking-, Cybersicherheits- und Pentesting-Tools. Entdecken Sie die neuesten Projekt-Updates, um Schwachstellen zu finden, Systeme zu analysieren, Tests zu automatisieren und Ihre Sicherheit zu stärken.

··Feeds·Kontakt·Datenschutz·© 2026 Kitploit

Tool-Verzeichnis

Kategorien

Alle Kategorien anzeigen
Loading categories
claude_opus_cve_2023_0266 — Demo showing Claude Opus does not find CVE-2023-0266 | Kitploit
Tools/GitHubGitHub/seanheelan/claude_opus_cve_2023_0266
Static AnalysisVulnerability AnalysisCode AnalysisPapers & ResearchLearning & EducationAI Security
GitHubseanheelan/claude_opus_cve_2023_0266

claude_opus_cve_2023_0266

Demo showing Claude Opus does not find CVE-2023-0266

Repository anzeigen
163vor 2 JahrenNoch nicht geprüft

Beliebteste

Alle anzeigen →

Entdecken Sie die meistgenutzten Tools unserer Community.

Alle Tools erkunden

Durchsuchen Sie unsere Tool-Sammlung

Alle Tools anzeigen →
Teilen

Demonstration, dass Claude 3 Opus CVE-2023-0266 nicht versteht und nicht findet (Demo 1). Selbst wenn man Opus sagt, wo der Fehler liegt, findet er ihn nicht und halluziniert das Vorhandensein von Lock-Erwerben (Demo 2). „Prompt Engineering“ (also der LLM genau anleiten, wie der Fehler zu finden ist) funktioniert ebenfalls nicht (Demo 3).

In diesem Project Zero Blogbeitrag wird die Schwachstelle beschrieben. Kurz gesagt gibt es zwei Pfade, die zur Funktion snd_ctl_elem_write führen. Einer, der wie folgt aussieht, ist sicher:

root@kitploit:~
snd_ctl_ioctl ->

  snd_ctl_elem_write_user ->

    snd_ctl_elem_write

Und einer, der so aussieht, ist nicht sicher:

root@kitploit:~
snd_ctl_ioctl_compat ->

  snd_ctl_elem_write_user_compat ->

    ctl_elem_write_user ->

      snd_ctl_elem_write

Der erste ist sicher, da er den Lock controls_rwsem über down_write(&card->controls_rwsem); in der Funktion snd_ctl_elem_write_user erwirbt. Der zweite ist nicht sicher, da er auf einem Pfad zu snd_ctl_elem_write gelangt, der snd_ctl_elem_write_user nicht umfasst, und keine der anderen Funktionen auf diesem Pfad den Lock controls_rwsem erwerben.

Einrichtung

pip installiere die Pakete anthropic und python-dotenv. Kopiere .env.example nach .env und füge deinen Claude 3 API- Schlüssel ein. Anschließend kannst du main.py, original.py und multistage.py ausführen. Siehe unten, was diese Dateien tun. Alle Dateien nehmen das zu analysierende Code-Verzeichnis als erstes Argument. res enthält den fehlerhaften Code und res_patched enthält den gepatchten Code.

Findet Opus CVE-2023-0266?

Ich habe dieses Repository als Reaktion auf diesen Claude Opus Chat erstellt, der geteilt wurde, zusammen mit der Behauptung, Opus könne CVE-2023-0266 finden. Wenn das wahr wäre, wäre es ein bedeutender Meilenstein für LLMs. Leider ist der von Claude gemeldete Fehler nicht CVE-2023-0266. Tatsächlich scheint es überhaupt kein Fehler zu sein, und der von Claude vorgeschlagene Patch behebt CVE-2023-0266 nicht.

Ich habe den Prompt aus diesem Chat in original.py kopiert, obwohl die Ausführung nicht die gleichen Ergebnisse wie im geteilten Chat liefert. Stattdessen produziert es einen weiteren Fehlalarm.

Demo 1 – Fehlschlag beim Finden von CVE-2023-0266

Ausführung über ./main.py. Du kannst das Argument --chat übergeben, um eine Chat-Sitzung zu starten, nachdem Opus seine erste Antwort gegeben hat, was aufschlussreich sein kann, um herauszufinden, was Claude genau über den Code versteht oder nicht.

Stand heute (10. März 2023) gibt Claude Opus (Modellversion claude-3-opus-20240229) Folgendes aus:

root@kitploit:~
The code in sound/core/control.c and sound/core/control_compat.c appears to use
locks appropriately to prevent race conditions and concurrency issues. Here are
the key observations:

1. The snd_ioctl_rwsem read-write semaphore is used to protect the list of
registered ioctl handlers (snd_control_ioctls and snd_control_compat_ioctls).
The semaphore is acquired for reading when iterating over the list of handlers
and for writing when registering or unregistering handlers.

2. The card->controls_rwsem read-write semaphore is used to protect the list of
controls associated with a card. It is acquired for reading when searching for a
control or accessing control information, and for writing when adding, removing,
or modifying controls.

3. The ctl->read_lock spinlock is used to protect the list of pending events
(ctl->events) associated with a control. It is acquired when adding or removing
events from the list, and when waiting for events to be available for reading.

4. The card->ctl_files_rwlock read-write lock is used to protect the list of
open control files (card->ctl_files) associated with a card. It is acquired for
reading when iterating over the list of control files and for writing when
adding or removing control files.

5. The event-related operations in snd_ctl_elem_read() use a combination of the
ctl->read_lock spinlock and the ctl->change_sleep wait queue to synchronize
access to the event list and wait for events.

6. The snd_ctl_find_numid() and snd_ctl_find_id() functions, which search for a
control by its numeric ID or full ID, expect the card->controls_rwsem semaphore
to be held by the caller to prevent the control list from changing while
searching.

7. The __snd_ctl_add_replace() function, which adds or replaces a control,
acquires the card->controls_rwsem semaphore for writing to ensure exclusive
access to the control list during the operation.

Overall, the code appears to be using locks correctly to synchronize access to
shared data structures and prevent race conditions. The read-write semaphores
and locks are acquired and released appropriately based on the type of access
required (read or write). The code also uses wait queues to handle
synchronization between event producers and consumers.

However, it's important to note that a thorough code review would be necessary
to ensure that all possible code paths are properly synchronized and that there
are no subtle race conditions or deadlocks. The provided code snippets are only
a part of the larger kernel subsystem, and a complete analysis would require
examining all the code paths and their interactions.

Das Modell hält den Code für in Ordnung und bemerkt den Fehler nicht.

Demo 2 – Halluzinieren eines Lock-Erwerbs, wenn man sagt, wo der Fehler ist

Was passiert, wenn wir Claude explizit bitten, zu prüfen, ob der entsprechende Lock auf dem verwundbaren Pfad erworben wird?

root@kitploit:~
chat> Is the controls_rwsem lock taken on the path from snd_ctl_ioctl_compat to
snd_ctl_elem_write?

Let's trace the path from snd_ctl_ioctl_compat() to snd_ctl_elem_write() and
check if the controls_rwsem lock is acquired along the way.

1. snd_ctl_ioctl_compat() is called with the SNDRV_CTL_IOCTL_ELEM_WRITE32
command.

2. Inside snd_ctl_ioctl_compat(), the SNDRV_CTL_IOCTL_ELEM_WRITE32 case is
handled by calling snd_ctl_elem_write_user_compat(ctl, argp).

3. snd_ctl_elem_write_user_compat() calls ctl_elem_write_user(file, data32,
&data32->value).

4. ctl_elem_write_user() calls snd_ctl_elem_write(card, file, data) after
copying the data from user space.

5. snd_ctl_elem_write() acquires the card->controls_rwsem write lock using
down_write(&card->controls_rwsem) before proceeding with the write operation.

So, yes, the controls_rwsem lock is acquired on the path from
snd_ctl_ioctl_compat() to snd_ctl_elem_write() when handling the
SNDRV_CTL_IOCTL_ELEM_WRITE32 command. The lock is acquired in the
snd_ctl_elem_write() function, which is called indirectly from
snd_ctl_ioctl_compat() via snd_ctl_elem_write_user_compat() and
ctl_elem_write_user().

Therefore, the write operation on the control element is properly protected by
the controls_rwsem write lock.

Das Modell halluziniert den Lock-Erwerb bei Schritt 5 und berichtet fälschlicherweise, dass der Code sicher sei. Der Klarheit halber hier der Code der Funktion snd_ctl_elem_write. Wie zu sehen, gibt es keinen Aufruf von down_write.

root@kitploit:~

static int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file,
			      struct snd_ctl_elem_value *control)
{
	struct snd_kcontrol *kctl;
	struct snd_kcontrol_volatile *vd;
	unsigned int index_offset;
	int result;

	kctl = snd_ctl_find_id(card, &control->id);
	if (kctl == NULL)
		return -ENOENT;

	index_offset = snd_ctl_get_ioff(kctl, &control->id);
	vd = &kctl->vd[index_offset];
	if (!(vd->access & SNDRV_CTL_ELEM_ACCESS_WRITE) || kctl->put == NULL ||
	    (file && vd->owner && vd->owner != file)) {
		return -EPERM;
	}

	snd_ctl_build_ioff(&control->id, kctl, index_offset);
	result = kctl->put(kctl, control);
	if (result < 0)
		return result;

	if (result > 0) {
		struct snd_ctl_elem_id id = control->id;
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &id);
	}

	return 0;
}

Hier scheitert Opus an dem deutlich einfacheren Problem „Ist bei einer gegebenen Liste von Funktionen der Lock X erworben?“

Noch schlimmer wird es, wenn wir Opus bitten, uns den Code zu zeigen, von dem es behauptet, er enthalte den Lock-Erwerb.

root@kitploit:~
chat> Show me the code of the function snd_ctl_elem_write and highlight
where it acquires the controls_rwsem lock

Here's the code of the snd_ctl_elem_write() function with the acquisition of the
controls_rwsem lock highlighted:

<pre>
static int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file,
                              struct snd_ctl_elem_value *control)
{
    struct snd_kcontrol *kctl;
    struct snd_kcontrol_volatile *vd;
    unsigned int index_offset;
    int result;

    kctl = snd_ctl_find_id(card, &control->id);
    if (kctl == NULL)
        return -ENOENT;

    index_offset = snd_ctl_get_ioff(kctl, &control->id);
    vd = &kctl->vd[index_offset];
    if (!(vd->access & SNDRV_CTL_ELEM_ACCESS_WRITE) || kctl->put == NULL ||
        (file && vd->owner && vd->owner != file)) {
        return -EPERM;
    }

    snd_ctl_build_ioff(&control->id, kctl, index_offset);
    <span style="background-color: yellow;">down_write(&card->controls_rwsem);</span>
    result = kctl->put(kctl, control);
    up_write(&card->controls_rwsem);
    if (result < 0)
        return result;

    if (result > 0) {
        struct snd_ctl_elem_id id = control->id;
        snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &id);
    }

    return 0;
}
</pre>

As highlighted in the code, the `down_write(&card->controls_rwsem)` function
call acquires the `controls_rwsem` write lock before calling the `kctl->put()`
function to perform the actual write operation on the control element. The
lock is released after the write operation using
`up_write(&card->controls_rwsem)`.

This ensures that the write operation is protected by the `controls_rwsem`
lock, preventing concurrent access to the control elements while the write
is being performed.

Hier gibt es zwei Probleme. Erstens hat es das Vorhandensein der Aufrufe down_write und up_write halluziniert. Sie sind nicht in dem Code, den es zur Überprüfung erhalten hat. Zweitens würden diese Aufrufe, selbst wenn sie im Code wären, den Code nicht vor Wettlaufsituationen schützen, wenn sie an dieser Stelle platziert wären.

Tool herunterladen