Skip to content
KitploitKITPLOIT
StrumentiBlog
Invia
StrumentiBlog
Invia

Strumenti di Hacking, PenTest e Cybersecurity per il tuo Arsenale di Sicurezza!

Kitploit è una directory di strumenti di hacking, cybersecurity e pentesting. Scopri gli ultimi aggiornamenti dei progetti per trovare vulnerabilità, analizzare sistemi, automatizzare i test e rafforzare la tua sicurezza.

··Feed·Contatto·Privacy·© 2026 Kitploit

Directory degli strumenti

Categorie

Vedi tutte le categorie
Loading categories
af_packet.c — Prova di concetto per verificare i privilegi di af_packet.c per convalidare i privilegi acquisiti da qualsiasi hacker dopo lo sfruttamento riuscito di CVE-2021-22600 | Kitploit
Strumenti/GitHubGitHub/chinmay1743/af_packet.c
Escalation di PrivilegiAnalisi delle VulnerabilitàExploitPenetration TestingAnalisi di BinariApprendimento e Formazione
GitHubchinmay1743/af_packet.c

af_packet.c

Prova di concetto per verificare i privilegi di af_packet.c per convalidare i privilegi acquisiti da qualsiasi hacker dopo lo sfruttamento riuscito di CVE-2021-22600

Vedi Repository
1111 mesi faNon ancora revisionato

Più Popolari

Vedi tutti →

Scopri gli strumenti più utilizzati dalla nostra community.

Esplora tutti gli strumenti

Sfoglia la nostra collezione di strumenti

Vedi tutti gli strumenti →
Condividi

af_packet.c

Proof-Of-Concept per verificare i privilegi di af_packet.c per convalidare i privilegi acquisiti da qualsiasi hacker in seguito al successo dello sfruttamento di CVE-2021-22600


È solo un esempio di proof of concept generato da LLM e non copre tutti i casi. L'idea alla base di questo proof of concept è verificare con quali privilegi viene eseguito il codice target (ad esempio nello spazio utente o nel kernel) per comprendere le implicazioni del suo sfruttamento con qualsiasi exploit basato su CVE-2021-22600. Questo codice non è in alcun modo un exploit della CVE menzionata. L'ho testato su Ubuntu in una VM. I risultati possono variare in base all'ambiente.


Passaggi per compilare ed eseguire il codice:

root@kitploit:~
gcc program.c -o runme
chmod +x runme
./runme
sudo ./runme

Output di esempio per esecuzione come utente normale:

root@kitploit:~
<..SNIP..>
=== AF_PACKET privilege probe ===
UID=1000  EUID=1000

WARNING: couldn't read CapEff from /proc/self/status. Continuing anyway.
Stage 1: try AF_PACKET + SOCK_DGRAM (no CAP_NET_RAW required by kernel check)
socket(AF_PACKET, SOCK_DGRAM, ETH_P_ALL) => FAILED: Operation not permitted (errno=1)

Stage 2: try AF_PACKET + SOCK_RAW (kernel checks CAP_NET_RAW for SOCK_RAW)
socket(AF_PACKET, SOCK_RAW, ETH_P_ALL) => FAILED: Operation not permitted (errno=1)
RAW socket creation failed: you cannot reach packet_set_ring() from user-land without CAP_NET_RAW.
Common results:
 - errno=EPERM (Operation not permitted) : you lack CAP_NET_RAW
 - errno=EACCES : sometimes indicates policy or network namespace restrictions

Notes:
 - The kernel enforces CAP_NET_RAW at socket creation: look for a check like
     if (sock->type == SOCK_RAW && !capable(CAP_NET_RAW)) return -EPERM;
   in net/packet/af_packet.c (this is why PACKET_RX_RING is unreachable without that socket).
 - If you run this program as root or with CAP_NET_RAW, the RAW socket will succeed and
   setsockopt(PACKET_RX_RING) will attempt to configure the ring (it may still fail with EINVAL
   if your parameters are invalid, but you will have invoked packet_set_ring()).

=== Done ===
<..SNIP..>

Output di esempio per esecuzione come sudo / utente root:

root@kitploit:~
<..SNIP..>
=== AF_PACKET privilege probe ===
UID=0  EUID=0

CapEff (hex) = 0x000001ffffffffff
 -> CAP_NET_RAW (bit 12) = YES

Stage 1: try AF_PACKET + SOCK_DGRAM (no CAP_NET_RAW required by kernel check)
socket(AF_PACKET, SOCK_DGRAM, ETH_P_ALL) => OK (fd=3)

Stage 2: try AF_PACKET + SOCK_RAW (kernel checks CAP_NET_RAW for SOCK_RAW)
socket(AF_PACKET, SOCK_RAW, ETH_P_ALL) => OK (fd=3)
Since RAW socket creation succeeded, we likely have CAP_NET_RAW (or are root).

Stage 3: try setsockopt PACKET_RX_RING (this invokes packet_set_ring in kernel)
setsockopt(PACKET_RX_RING) => OK

Notes:
 - The kernel enforces CAP_NET_RAW at socket creation: look for a check like
     if (sock->type == SOCK_RAW && !capable(CAP_NET_RAW)) return -EPERM;
   in net/packet/af_packet.c (this is why PACKET_RX_RING is unreachable without that socket).
 - If you run this program as root or with CAP_NET_RAW, the RAW socket will succeed and
   setsockopt(PACKET_RX_RING) will attempt to configure the ring (it may still fail with EINVAL
   if your parameters are invalid, but you will have invoked packet_set_ring()).

=== Done ===
<..SNIP..>

Scarica lo strumento