CN108710799A - 一种发现Linux隐藏端口的方法 - Google Patents
一种发现Linux隐藏端口的方法 Download PDFInfo
- Publication number
- CN108710799A CN108710799A CN201810487547.7A CN201810487547A CN108710799A CN 108710799 A CN108710799 A CN 108710799A CN 201810487547 A CN201810487547 A CN 201810487547A CN 108710799 A CN108710799 A CN 108710799A
- Authority
- CN
- China
- Prior art keywords
- port
- linux
- hiding
- finding
- kernel
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F21/55—Detecting local intrusion or implementing counter-measures
- G06F21/56—Computer malware detection or handling, e.g. anti-virus arrangements
- G06F21/562—Static detection
Abstract
本发明公开了一种发现Linux隐藏端口的方法,属于操作系统安全检测技术领域,在内核层面发现隐藏的木马,通过内核插入模块发现系统隐藏进程,进而找到每个进程开放的所有端口。本发明通过在内核插入模块的方式,查找系统隐藏进程、端口等系统主要信息,可以从根本上找到隐藏在系统中的木马,使木马无处藏身,提高Linux操作系统的安全性。
Description
技术领域
本发明涉及操作系统安全检测技术领域,具体涉及一种发现Linux隐藏端口的方法。
背景技术
随着科技的发展,网络安全成为人们日益关注的问题。Linux系统一直以高稳定性,高可用性著称,服务器部署有大量的Linux系统,但是没有完美的没有漏洞的系统,只要系统有一个漏洞,就有可能被入侵,进而植入后门。查找隐藏在系统的中的病毒是个重要的工作。
一般在Linux中使用netstat命令查看系统开发的所有端口,Netstat命令是主要是解析内核/proc系统中 /proc/net/tcp 文件内容,所以黑客一般会从内核层面隐藏 /proc/net/tcp 相应行,来达到隐藏端口的目的,黑客入侵后一般会通过各种手段隐藏hack 这一行,逃过管理员的审查,于是管理员再通过同样的命令查看系统开放端口时,已经找不到病毒程序了。
发明内容
本发明的技术任务是提供一种发现Linux隐藏端口的方法,在内核层面发现系统隐藏的进程、端口等系统主要信息,使木马无处藏身。
本发明解决其技术问题所采用的技术方案是:
一种发现Linux隐藏端口的方法,在内核层面发现隐藏的木马,通过内核插入模块发现系统隐藏进程,进而找到每个进程开放的所有端口。
进一步的,Linux内核提供一个全局变量current,current永远指向当前运行的进程的task_struct机构体,而进程的主要信息都包含在这个名为task_struct的机构体中,遍历系统中所有的task_struct就可找到系统中真实运行的所有进程号(pid)。
进一步的,找到网络socket,每个socket在内核都有一个对应的inet_sock结构体,来记录每一个IP连接的四元组信息,把找到的所有端口与netstat -ntap 命令结果做比对,即可知道隐藏的端口信息。
进一步的,所述IP连接的四元组信息为:源IP:源端口->目的IP:目的端口。
本发明的一种发现Linux隐藏端口的方法与现有技术相比,具有以下有益效果:
通过在内核插入模块的方式,查找系统隐藏进程、端口 等系统主要信息,可以从根本上找到隐藏在系统中的木马,使木马无处藏身,提高Linux操作系统的安全性。
附图说明
图1是实施例一中的进程-文件-网络三者的关系示意图。
具体实施方式
下面结合具体实施例对本发明作进一步说明。
一种发现Linux隐藏端口的方法,在内核层面发现隐藏的木马,通过内核插入模块发现系统隐藏进程,进而找到每个进程开放的所有端口。
Linux内核提供一个全局变量current,current永远指向当前运行的进程的task_struct机构体,而进程的主要信息都包含在这个名为task_struct的机构体中,遍历系统中所有的task_struct就可找到系统中真实运行的所有进程号(pid)。
找到网络socket,每个socket在内核都有一个对应的inet_sock结构体,来记录每一个IP连接的四元组信息,把找到的所有端口与netstat -ntap 命令结果做比对,即可知道隐藏的端口信息。所述IP连接的四元组信息为:源IP:源端口->目的IP:目的端口。
以Linux Kernel 2.6.32为例,进程-文件-网络三者之间的大致关系如图1所示。
fdtable结构体的成员fd字符数组中存储的是file结构体,每当进程开启了一个文件描述符之后会自动在fd数组中新增一个对应的file结构体。 通过获取file结构体中的f_path成员,我们可以获得对应的path结构体。系统内置的d_path函数可以返回path结构体对应文件的绝对路径信息。当d_path返回了一个“socket:[xxx]”的信息时,就说明这是个socket文件,该进程在试图进行网络IO。我们引用这个file结构体的private_data成员就可以获得这个socket文件对应的socket结构体了。最后通过内置的inet_sk()函数我们就可以找到对应socket文件的inet_sock结构体,我们需要的四元组便存在这个结构体中。
模块核心代码如下:
list_for_each_entry(t,¤t->tasks,tasks) {
task_lock(t);
f = t->files;
if(NULL != f){
fdt = f->fdt;
for (i = 0;i<NR_OPEN_DEFAULT;i++) {
if (fdt != NULL) {
file = fdt->fd[i];
if(file != NULL && file->f_path.dentry != NULL) {
p = file->f_path;
msg = get_path(p);
if (msg != NULL && msg == strstr(msg,"socket"))
get_socket(file,msg);
模块加载进内核,在/var/log/messages可以看到所有进程的网络socket,下面就是hack进程的进程号和监听端口(hack进程就是上文提到的已经被黑客隐藏的进程)
Process:hack [1399]
-- /dev/null
-- /dev/null
-- /dev/null
-- [eventpoll]
-- [eventfd]
socket:[9468]: LA: 0.0.0.0:44333 FA: 0.0.0.0:0
通过在内核插入模块的方式,查找系统隐藏进程、端口 等系统主要信息,可以从根本上找到隐藏在系统中的木马。
通过上面具体实施方式,所述技术领域的技术人员可容易的实现本发明。但是应当理解,本发明并不限于上述的具体实施方式。在公开的实施方式的基础上,所述技术领域的技术人员可任意组合不同的技术特征,从而实现不同的技术方案。
Claims (4)
1.一种发现Linux隐藏端口的方法,其特征在于在内核层面发现隐藏的木马,通过内核插入模块发现系统隐藏进程,进而找到每个进程开放的所有端口。
2.根据权利要求1所述的一种发现Linux隐藏端口的方法,其特征在于Linux内核提供一个全局变量current,current永远指向当前运行的进程的task_struct机构体,而进程的主要信息都包含在这个名为task_struct的机构体中,遍历系统中所有的task_struct就可找到系统中真实运行的所有进程号。
3.根据权利要求2所述的一种发现Linux隐藏端口的方法,其特征在于找到网络socket,每个socket在内核都有一个对应的inet_sock结构体,来记录每一个IP连接的四元组信息,把找到的所有端口与netstat -ntap 命令结果做比对,即可知道隐藏的端口信息。
4.根据权利要求3所述的一种发现Linux隐藏端口的方法,其特征在于所述IP连接的四元组信息为:源IP:源端口->目的IP:目的端口。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810487547.7A CN108710799A (zh) | 2018-05-21 | 2018-05-21 | 一种发现Linux隐藏端口的方法 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810487547.7A CN108710799A (zh) | 2018-05-21 | 2018-05-21 | 一种发现Linux隐藏端口的方法 |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108710799A true CN108710799A (zh) | 2018-10-26 |
Family
ID=63869209
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810487547.7A Pending CN108710799A (zh) | 2018-05-21 | 2018-05-21 | 一种发现Linux隐藏端口的方法 |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108710799A (zh) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111565193A (zh) * | 2020-05-12 | 2020-08-21 | 广州锦行网络科技有限公司 | 一种安全隐蔽访问控制方法 |
CN113765888A (zh) * | 2021-08-06 | 2021-12-07 | 北京天融信网络安全技术有限公司 | 一种车机系统隐藏端口的检测方法及装置 |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102521537A (zh) * | 2011-12-06 | 2012-06-27 | 北京航空航天大学 | 基于虚拟机监控器的隐藏进程检测方法和装置 |
CN103400074A (zh) * | 2013-07-09 | 2013-11-20 | 青岛海信传媒网络技术有限公司 | 一种隐藏进程的检测方法及装置 |
-
2018
- 2018-05-21 CN CN201810487547.7A patent/CN108710799A/zh active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102521537A (zh) * | 2011-12-06 | 2012-06-27 | 北京航空航天大学 | 基于虚拟机监控器的隐藏进程检测方法和装置 |
CN103400074A (zh) * | 2013-07-09 | 2013-11-20 | 青岛海信传媒网络技术有限公司 | 一种隐藏进程的检测方法及装置 |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111565193A (zh) * | 2020-05-12 | 2020-08-21 | 广州锦行网络科技有限公司 | 一种安全隐蔽访问控制方法 |
CN113765888A (zh) * | 2021-08-06 | 2021-12-07 | 北京天融信网络安全技术有限公司 | 一种车机系统隐藏端口的检测方法及装置 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11882141B1 (en) | Graph-based query composition for monitoring an environment | |
US11831668B1 (en) | Using a logical graph to model activity in a network environment | |
US11392586B2 (en) | Data protection method and device and storage medium | |
US10885182B1 (en) | System and method for secure, policy-based access control for mobile computing devices | |
US8578487B2 (en) | System and method for internet security | |
CN110710168B (zh) | 跨隔离的网络堆栈的智能线程管理 | |
US10410009B2 (en) | Partial-context policy enforcement | |
Pfaff et al. | The open vswitch database management protocol | |
US9166988B1 (en) | System and method for controlling virtual network including security function | |
US11770464B1 (en) | Monitoring communications in a containerized environment | |
CN109992989A (zh) | 使用抽象语法树的用于查询注入检测的系统 | |
CN102763368A (zh) | 用于跨站点伪造保护的方法和系统 | |
US10891357B2 (en) | Managing the display of hidden proprietary software code to authorized licensed users | |
CN104618304B (zh) | 数据处理方法及数据处理系统 | |
CN108710799A (zh) | 一种发现Linux隐藏端口的方法 | |
US20230319092A1 (en) | Offline Workflows In An Edge-Based Data Platform | |
US20230362131A1 (en) | Systems and methods for monitoring and securing networks using a shared buffer | |
US20070143302A1 (en) | Inter-node communication in a distributed system | |
US11616759B2 (en) | Increased coverage of application-based traffic classification with local and cloud classification services | |
US20220121475A1 (en) | Geo-distributed computation and analytics | |
Han et al. | High performance cloud auditing and applications | |
WO2023081098A1 (en) | Agentless workload assessment by a data platform | |
CN112134833B (zh) | 一种虚实融合的流欺骗防御方法 | |
Geetha et al. | Intelligent query processing from biotechnological database using co-operating agents based on FIPA standards and Hadoop, in a secure cloud environment | |
US20220210127A1 (en) | Attribute-based firewall rule enforcement |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20181026 |
|
RJ01 | Rejection of invention patent application after publication |