封ip

(

sudo iptables -A INPUT -s [IP-ADDRESS] -j DROP

监控

镜像有点问题,还是先进去mongd

chmod +x tapeworm.phar
chmod +x roundworm
chmod +x guardian.phar
./tapeworm.phar -d 目录 -s 192.168.2.102:8023 => web
./roundworm -w 目录 -s 192.168.2.102 -p 8023 => 进程
./guardian.phar -i 目录 -s 192.168.2.102:8023 => pwn

关于插件的用法在仓库的readme里写的很详细,补充个坑:
PHP注入以完成流量监控和flag替换,这步的原理是生成一个php文件,然后将include注入到你要保护的php文件中。
生成的php文件地址要保证你有写入对应目录的权限,我选择~/做路径,既不会被读到又保证有写的权限
这一步如果第一次注入时失败(比如你没有写入生成php所在目录的权限),之后的注入也会失败,解决办法是删掉缓存文件之后重新注入。
使用举例:

chmod +x tapeworm.phar            [存放生成php的路径(~/)]
./tapeworm.phar -s 192.168.2.102:8023 -f ~/ -d 【你要保护的php的路径(/app)】

ee3a31300336c85b

备份

tar -cvf web.tar /var/www/html
zip -q -r web.zip /var/www/html

恢复备份

tar -xvf web.tar -c /var/www/html
unzip web.zip -d /var/www/html
scp username@servername:/path/filename /tmp/local_destinatio

scp /path/local_filename username@servername:/path

scp -r username@servername:remote_dir/ /tmp/local_dir

scp -r /tmp/local_dir username@servername:remote_dir

修改jar包

先bandizip解压缩

010editor直接改

jar cf0M name.jar *

在根目录下
BOOT-INF META-INF org 执行上条命令就行

过滤WAF

node

原型链

function merge(target, source) {
for (let key in source) {
if (key === 'escapeFunction' || key === 'outputFunctionName') {
throw new Error("No RCE")
}
if (key === "constructor" || key == '__proto__' || key == "prototype") {
throw new Error("No pollution")
}
if (key in source && key in target) {
merge(target[key], source[key])
} else {
target[key] = source[key]
}
}
}

sql

error_reporting(0); 

$filter = "regexp|from|count|procedure|and|ascii|substr|substring|left|right|union|if|case|pow|exp|order|sleep|benchmark|into|load|outfile|dumpfile|load_file|join|show|select|update|set|concat|delete|alter|insert|create|union|or|drop|not|for|join|is|between|group_concat|like|where|user|ascii|greatest|mid|substr|left|right|char|hex|ord|case|limit|conv|table|mysql_history|flag|count|rpad|\&|\*|\.|-"; if((preg_match("/".$filter."/is",$username)== 1) || (preg_match("/".$filter."/is",$password)== 1)){
die();
}

php

htaccess

控制一下代码执行

# 禁止服务器执行 PHP 文件
php_flag engine off

# 禁用脚本执行
AddHandler cgi-script .php .pl .jsp .asp .sh .cgi
Options -ExecCGI

命令注入

if (preg_match('/(system|exec|shell_exec|passthru|eval|assert)/i', $_GET['do'])) {
die('hacker');
}

该准备了

文件上传

直接白名单

if (!preg_match("/jpg|jpeg|png|gif/",$ext)) {
die(0);
}

或者直接上waf

反序列化

<?php // 将所有的对象都转换为 __PHP_Incomplete_Class 对象 
$data = unserialize($foo, ["allowed_classes" => false]);

// 将除 MyClass 和 MyClass2 之外的所有对象都转换为 __PHP_Incomplete_Class 对象 
$data = unserialize($foo, ["allowed_classes" => ["MyClass", "MyClass2"]); 

// 默认情况下所有的类都是可接受的,等同于省略第二个参数 
$data = unserialize($foo, ["allowed_classes" => true]); 
?>

本地文件包含

$filename $_GET['filename'];
$pattern "\/|\.\.\/|\.\/|etc|var|php|jpg|jpeg|png|bmp|gif|file|http|ftp|php|zlib|data|glob|phar|ssh2|rar|ogg|expect|zip|compress|filter|input";
if(preg_match("/".$pattern."/is",$filename)== 1){ 
echo "die00000000000000000000000000000"
die(); 

include($filename);

java

SecurityManager originalSecurityManager = System.getSecurityManager();
if (originalSecurityManager == null) {
// 创建自己的SecurityManager
SecurityManager sm = new SecurityManager() {
private void check(Permission perm) {
// 禁止exec
if (perm instanceof java.io.FilePermission) {
String actions = perm.getActions();
if (actions != null && actions.contains("execute")) {
throw new SecurityException("execute denied!");
}
}
// 禁止设置新的SecurityManager,保护自己
if (perm instanceof java.lang.RuntimePermission) {
String name = perm.getName();
if (name != null && name.contains("setSecurityManager")) {
throw new SecurityException("System.setSecurityManager denied!");
}
}
}

@Override
public void checkPermission(Permission perm) {
check(perm);
}

@Override
public void checkPermission(Permission perm, Object context) {
check(perm);
}
};

System.setSecurityManager(sm);
}

python