// Tutorials

Ruby for Pentesters

Ruby from your first HTTP request to a working Metasploit module, taught by building a full exploit chain against the retired HackTheBox machine Bizness — recon, auth bypass, RCE, a reverse shell, looting, cracking, becoming root, tooling, testing, and the module.

  1. Part 1Your first recon tool

    7 min read
    Rubynet/httpReconBeginner

    Install Ruby 4, meet irb, and write your very first script — an HTTP client that fingerprints a target. We point it at the retired HackTheBox machine Bizness and confirm what's running.

  2. Part 2Walking past the login

    5 min read
    RubyCVE-2023-51467Auth BypassMethods

    OFBiz has an authentication bypass (CVE-2023-51467). We turn that into a reusable Ruby method, learn how functions and constants work, and confirm we're past the login gate.

  3. Part 3First code execution

    5 min read
    RubyRCEPOSTHashes

    We point the auth bypass at OFBiz's ProgramExport screen, POST a Groovy payload, and run our first command on the box. Along the way you learn POST requests, hashes, and pulling data back out of a response.

  4. Part 4Catching a shell

    5 min read
    RubyReverse ShellSocketsThreads

    Reflected output is clumsy. We write our own TCP listener in Ruby to catch an interactive reverse shell — and learn sockets and threads doing it.

  5. Part 5Looting the database

    5 min read
    RubyRegexFilesCredentials

    With a shell as ofbiz, we go after the admin password hash. OFBiz's embedded Derby database sits in flat files on disk — we grep them, then learn regex and file handling to pull the hash out cleanly.

  6. Part 6Cracking a nonstandard hash

    6 min read
    RubyHashingDigestThreads

    The admin hash isn't in any standard format hashcat ships with, so we reimplement OFBiz's exact hashing in Ruby and brute it against a wordlist. Then we build a thread pool to parallelize it — and meet the GVL, the reason Part 4's threads sped up network work but won't speed up pure hashing.

  7. Part 7Becoming root

    4 min read
    RubyPrivilege EscalationOpen3PTY

    The cracked password is root's too — plain password reuse. We spend it to escalate, and learn the handful of ways Ruby runs external programs — system, backticks, Open3 — ending with a PTY to drive an interactive su.

  8. Part 8From scripts to a tool

    5 min read
    RubyClassesOOPCLI

    Several throwaway scripts that all rebuild the same HTTP client. We fold them into one reusable class and give it a real command-line interface with OptionParser — the jump from scripting to tooling.

  9. Part 9Testing your tool

    4 min read
    RubyTestingminitestDesign

    A tool you'll rerun deserves a safety net. We meet minitest, Ruby's built-in test framework, and learn to write code that's testable — separating the logic you can check from the network you can't.

  10. Part 10Shipping it as a Metasploit module

    6 min read
    RubyMetasploitModulesCapstone

    The finale. A Metasploit module is just a Ruby class in the framework's shape — so we lift the exact OFBiz chain into one, and let the framework hand us HTTP, options, payloads, and a shell for free.

← All tutorials