คือมันมี process รัน sh จาก หน้าเวป
โดย user คือ apache นะครับ
kill ก็ โผล่ ใหม่ มันจะโหลด ของไปไว้ที่ /tmp ไว้ ทำ backdoor หรืออื่นๆนะครับ
เราจะ config ไม่ให้ user apache รัน sh ได้ไหมครับ
ขอบคุณครับ
disable function ใน php ไว้บ้างหรือเปล่าครับ
อันนี้ คือ rpocess ทีโดนเรียกนะครับ
apache
ก็ พอมีนะครับ
disable_functions = passthru, pcntl_exec, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, popen, pclose, ini_alter, virtual
, openlog, escapeshellcmd
ตอนนี้ได้ข่าวว่ามี r57shell ระบาดอยู่ ทำตัวเหมือน shell กำลังติดตาม r57shell อยู่ว่ามาจากแห่งหนตำบลใด…
exec หายไปใหนล่ะครับ ตัวหลักๆเลยแหละ
ลอง find แล้วนะครั บไม่เจอ r57shell.php เลยนะครับ
คือ เผอิญ ใช้ ในการ รัน คำสั่ง uptime ของผม เองนะครับ ไว้ดู overload ผ่านหน้าเวปนะครับ
ตอนนี้ ได้ ลอง ปิดดุแล้ว รู้สึกจะไม่หายนะครับ
ยังสามารถเข้าได้นะครับ
12642 ?
มี system อีกตัวครับ
เพิ่มเติม: เอาเต็มๆไปเลยละกัน
disable_functions = system, exec, shell_exec, passthru, pcntl_exec, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, popen, pclose, set_time_limit, ini_alter, virtual, openlog, escapeshellcmd
- สร้าง /tmp เป็น partition แยกต่างหาก และ set mode ไม่ให้ run โปรแกรมใดๆ ได้
The first step is to check if /tmp is already secure. Some datacenters do not create a /tmp partition while others do.
-----command-----
df -h |grep tmp
-----command-----
If that displays nothing then go below to create a tmp partition. If you do have a tmp partition you need to see if it mounted with noexec.
-----command-----
cat /etc/fstab |grep tmp
-----command-----
If there is a line that includes /tmp and noexec then it is already mounted as non-executable. If not follow the instructions below to create one without having to physically format your disk. Idealy you would make a real partition when the disk was originally formated, that being said I have not had any trouble create a /tmp partition using the following method.
Create a 190Mb partition
-----command-----
cd /dev/; dd if=/dev/zero of=tmpMnt bs=1024 count=200000
-----command-----
Format the partion
-----command-----
mke2fs /dev/tmpMnt
-----command-----
Make a backup of the old data
-----command-----
cp -Rp /tmp /tmp_backup
-----command-----
Mount the temp filesystem
-----command-----
mount -o loop,noexec,nosuid,rw /dev/tmpMnt /tmp
-----command-----
Set the permissions
-----command-----
chmod 0777 /tmp
-----command-----
Copy the old files back
-----command-----
cp -Rp /tmp_backup/* /tmp/
-----command-----
Once you do that go ahead and start mysql and make sure it works ok. If it does you can add this line to the bottom of the /etc/fstab to automatically have it mounted:
/dev/tmpMnt /tmp ext2 loop,noexec,nosuid,rw 0 0
While we are at it we are going to secure /dev/shm. Look for the mount line for /dev/shm and change it to the following:
none /dev/shm tmpfs noexec,nosuid 0 0
Umount and remount /dev/shm for the changes to take effect.
-----command-----
umount /dev/shm
mount /dev/shm
-----command-----
Next delete the old /var/tmp and create a link to /tmp
-----command-----
rm -rf /var/tmp/
ln -s /tmp/ /var/
-----command-----
If everything still works fine you can go ahead and delete the /tmp_backup directory.
-----command-----
rm -rf /tmp_backup
-----command-----
you can use the following and just add it to the fstab as stated above to do this…
Code:
df -h |grep tmp
cat /etc/fstab |grep tmp
cd /dev/; dd if=/dev/zero of=tmpMnt bs=1024 count=200000
/sbin/mke2fs /dev/tmpMnt
cp -Rp /tmp /tmp_backup
mount -o loop,noexec,nosuid,rw /dev/tmpMnt /tmp
chmod 0777 /tmp
cp -Rp /tmp_backup/* /tmp/
umount /dev/shm
mount /dev/shm
rm -rf /var/tmp/
ln -s /tmp/ /var/
rm -rf /tmp_backup
******NOTE on redhat 9 and possibly other distros you need to specify the filesystem type for the /tmp. this can be done by adding “-t tmpfs” to the end of the mount command. ensim needs a reboot afterwards.
/dev/tmpMnt /tmp ext2 loop,noexec,nosuid,rw 0 0
add somthing like that to the /etc/fstab
You /tmp, /var/tmp, and /dev/shm are now mounted in a way that no program can be directly run from these directories. Like I have said in other articles there are still ways in but this is one of the many layers of security you should have on your system.
Your done- /tmp is now mounted as noexec. You can sleep a little bit safer tonight. I created a hello world c++ and compiled it then moved it to /tmp.
#include <stdio.h>
int main() {
printf(“Hello World!
”);
return 0;
}
Upon trying to run it (even chmod +x’ed), it gives the following error:
bash: ./a.out: Permission denied
- mod_security http://www.modsecurity.org/download/index.html ช่วยคุณได้ครับ
ผมก็หาไม่เจอเหมือนกัน
PHPShell หรอครับ
ผมว่ามจากทีม security ไรสักอย่้างนี้ แหละ เคยไปเยี่ยม เวบผู้ผลิตมา ส่วน ที่ระบาดๆ นี่แสนทุเรศเอาไฟล์เค้ามารัน แล้วดันทะลึ่งไปแก้ credit เค้าออกใส่ตัวเองแทน
ถ้าจำไม่ผิด มากจากทีม security อะไรนี่แหละ ของพวกรัซเซีย
ผมเคยเจอ phpshell ตัวนี้ แหละ ไขว้!!! มาจากโอสอื่นมารันเฉย
งงเลยครับท่าน