You can not select more than 25 topics 
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long. 
		
		
		
		
		
			
	
	
		
			
	
		
			This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
		 
	
		
		
			
				
				
					
						
						
						
							---
 
						
						
						
							layout: post
 
						
						
						
							title: 一次服务器被入侵的经历
 
						
						
						
							tags: [Linux, 安全, 服务器, 入侵]
 
						
						
						
							---
 
						
						
						
							
 
						
						
						
							  即使是被入侵了也可以学到一些知识!<!--more-->     
 
						
						
						
							
 
						
						
						
							# 起因
  
						
						
						
							, , ,  
						
						
						
							  以前我倒也遇到过几次load值很高的情况, , , ,  
						
						
						
							
 
						
						
						
							# 检查服务器
  
						
						
						
							, , , , , , , , , ,  
						
						
						
							  后来查了些资料知道了可以用`lsof -p`查看进程读取的文件,才看到木马的本体:`/usr/bin/gs-dbus`。不过如果我只是杀掉这个进程然后删除文件,那攻击者肯定会重新回来,所以我得排除一下是不是还有别的木马文件。   
 
						
						
						
							  一般来说攻击者权限维持的方式大多是crontab, , , , , , ,  
						
						
						
							  不过感觉还是不够……所以我全盘搜索了一下`libprocesshider.so`文件,果不其然还有,通过那个文件在/usr/games里找到了木马的大本营, ,  
						
						
						
							  另外还有自启动到底是怎么实现的?  
						
						
						
							  至于为什么会被入侵……我也很清楚,其实并没有什么漏洞,单纯是设置的密码太简单了,被嘿客扫到啦!所以解决起来也很简单,把这些垃圾清除掉之后设置个稍微复杂一点的密码就行了。   
 
						
						
						
							
 
						
						
						
							# 入侵分析
  
						
						
						
							,  
						
						
						
							  除此之外里面还有个logclean项目,  
						
						
						
							  最后就是[libprocesshider](https://github.com/gianlucaborello/libprocesshider)这个项目,也许还有其他隐藏进程的方式,不过知道这个项目之后最起码以后再遇到类似的情况我就会优先去看`/etc/ld.so.preload`文件了。   
 
						
						
						
							  至于其他的就是一些爆破SSH的工具, , , , ,  
						
						
						
							
 
						
						
						
							# 感想