Browsing Category

Uncategorized

Uncategorized,

fix lỗi wordpress bị lỗi auto_increment

Kiểm tra xem bảng nào không có auto_increment, nếu có kết quả thì nghĩa là các bảng đó không có auto_increment

SELECT table_name
FROM information_schema.tables
WHERE table_schema = ‘vnsport_doelf’
AND table_type = ‘BASE TABLE’
AND table_name LIKE ‘sahdTR_%’
AND table_name NOT IN (
SELECT DISTINCT table_name
FROM information_schema.key_column_usage
WHERE table_schema = ‘vnsport_doelf’
AND constraint_name = ‘PRIMARY’
);

chạy lệnh sau để set auto_increment

SELECT CONCAT(
‘ALTER TABLE ‘, table_name,
‘ MODIFY ‘, column_name,
‘ INT UNSIGNED NOT NULL AUTO_INCREMENT;’
)
FROM information_schema.columns
WHERE table_schema = ‘vnsport_doelf’
AND column_key = ‘PRI’
AND extra NOT LIKE ‘%auto_increment%’;

 

Duplicate entry ‘1’ for key ‘PRIMARY’

Uncategorized,

reset lại terminal khi zsh đã crawl biến trong file .env

exec zsh -l

 

Hãy chắc chắn rằng file .env không chứa các ký tự không mong muốn như ^M. Để kiểm tra:

Chạy lệnh sau trong thư mục gốc của dự án:

cat -e .env

Kết quả sẽ hiển thị mỗi dòng kết thúc bằng $. Nếu bạn thấy ^M (Windows CRLF), bạn cần chuyển đổi sang Unix LF như đã hướng dẫn trước đó:

dos2unix .env

tắt terminal đi sau đó mở lại

Uncategorized,

Block wp-login and xmlrpc brute force attacks with CSF / DirectAdmin

https://github.com/tmiland/csf-custom-regex/blob/master/regex.custom.pm

 

Edit your /etc/csf/csf.conf like bellow:
CUSTOM1_LOG = “/var/log/httpd/domains/*.log”

We add the following rules to /usr/local/csf/bin/regex.custom.pm file. If it’s not there, create one.

Then we add bellow code :

# XMLRPC
if (($globlogs{CUSTOM1_LOG}{$lgfile}) and ($line =~ /(\S+).*] “\w*(?:GET|POST) \/xmlrpc\.php.*” /)) {
return (“WP XMLPRC Attack”,$1,”XMLRPC”,”5″,”80,443″,”1″);
}

# WP-LOGINS
if (($globlogs{CUSTOM1_LOG}{$lgfile}) and ($line =~ /(\S+).*] “\w*(?:GET|POST) \/wp-login\.php.*” /)) {
return (“WP Login Attack”,$1,”WPLOGIN”,”5″,”80,443″,”1″);
}

file tương tự như mẫu:

sub custom_line {
my$line = shift;
my$lgfile = shift;
if (($globlogs{CUSTOM1_LOG}{$lgfile}) and ($line =~ /^(\S+).*POST.*(wp-login\.php|xmlrpc\.php).* (200|401)/)) {
return (“Unauthorized”,$1,”WPLOGINorWHATEVER”,”10″,”80,443″,”14400″);
}
return 0;
}
1;

 

Finally we restart CSF and check if LFD is doing his new job :

csf -r

 

 

# WP-LOGINS
if (($globlogs{CUSTOM1_LOG}{$lgfile}) and ($line =~ /^(\S+).*POST.*(wp-login\.php|xmlrpc\.php).* (200|401)/)) {
    return ("Unauthorized",$1,"WPLOGINorWHATEVER","10","80,443","14400");