利用日志审计追踪APT***

APT***剖析
本文深入解析了APT***的特点及步骤,通过Google遭受极光***的例子,介绍了如何利用DNS日志等手段进行追踪。APT***是一种长期、隐蔽且有针对性的***方式,通常由高级威胁组织发起。

这个TT安全的文章讲述了Google的安全人员利用DNS日志来追踪极光(Aurora)***的事情。
作为一种典型的APT***,Google的安全经理Adkins说:“Google发现最有用的方法是系统数字取证、事件日志和恶意软件分析。”当Google发现了网络***后,安全团队变得十分敏感,他们仔细检查,不放过每个简单的异常事件。

【附】什么是APT***?这可是当下最热门的网络安全词汇了。
这里有个中文说明,应该是我看到的第一个中文版翻译的解释了。不过,说实在的,解释的很一般,都是一些表象的表象。建议看看wiki上的解释。The "Advanced Persistent Threat" (APT) refers to advanced and normally clandestine means to gain continual, persistent intelligence on an individual, or group of individuals such as a foreign nation state government.
而这个SANS 上的解释则更加详细。
简单的理解,APT***就是一类特定的***,为了获取某个组织甚至是国家的重要信息,有针对性的进行的一系列***行为的整个过程。APT***利用了多种***手段,包括各种最先进的手段和社会工程学方法,一步一步的获取进入组织内部的权限。APT往往利用组织内部的人员作为***跳板。有时候,***者会针对被***对象编写专门的***程序,而非使用一些通用的***代码。此外,APT***具有持续性,甚至长达1年,这种持续体现在***者不断尝试各种***手段,以及在***到网络内部后长期蛰伏,不断收集各种信息,直到收集到重要情报。总之,APT***具有很强的特定性,特指有明确目的的***,而非随意的***。因而,APT***也是Cyberwar,Cybersecurity重点关注的问题。
APT***的步骤,如下图,是这个SANS 博客写的。

另外,DarkReading也有一个步骤描述,跟上面的差不多:
 

1. Reconnaissance 勘查、踩点: Attackers research and identify individuals they will target in the attacks, using public search or other methods, and get their email addresses or instant messaging handles.

2. Intrusion into the network ***网络: It all typically starts with spear-phishing emails, where the attacker targets specific users within the target company with spoofed emails that include malicious links or malicious PDF or Microsoft Office document attachments. That infects the employee's machine and gives the attacker a foot in the door.

3. Establishing a backdoor 建立后门: The attackers try to get domain administrative credentials and extract them from the network. Since these credentials are typically encrypted, they then decrypt them using pass-the-hash or other tools and gain elevated user privileges. From here, they move "laterally" within the victim's network, installing backdoors here and there. They typically install malware via process injection, registry modification, or scheduled services, according to Mandiant.

4. Obtaining user credentials  获得用户凭据: Attackers get most of their access using valid user credentials, and they access an average of 40 systems on the victim's network using the stolen credentials, according to Mandiant. The most common type: domain-administrator credentials.

5. Installing multiple utilities 安装各种***软件: Utility programs are installed on the victim's network to conduct system administration, including installing backdoors, grabbing passwords, getting email, and listing running processes, for instance.
 

6. Privilege escalation, lateral movement, and data exfiltration 提权、数据泄漏: Now the attackers start grabbing emails, attachments, and files from servers via the attacker's C&C infrastructure. They typically funnel the stolen data to staging servers, where they encrypt and compress it, and then delete the compressed files from the staging server.

7. Maintaining persistence 持续***: If the attackers find they are being detected or remediated, then they use other methods to ensure they don't lose their presence in the victim's network, including revamping their malware.


 

FYI。

<think>嗯,用户想知道关于sudo命令产生的日志。首先,我需要回忆一下sudo的基本知识。sudo是用来让普通用户以其他用户权限执行命令的工具,通常用于获取root权限。关于日志,我记得sudo会记录用户执行过的命令,这对系统管理员来说很重要,可以审计和跟踪操作。 那具体来说,sudo的日志存在哪里呢?常见的应该是在/var/log目录下。不同的Linux发行版可能日志文件的位置和名称不一样,比如Ubuntu可能用auth.log,而CentOS或RHEL用secure。用户可能需要检查他们的系统具体使用哪个文件。例如,使用命令`sudo grep sudo /var/log/auth.log`来查看相关日志条目。 接下来,sudo的日志记录级别和内容。默认情况下,sudo会记录执行命令的用户、时间、执行的命令以及是否成功。但可能需要配置更详细的日志,比如在/etc/sudoers里添加logfile选项或者使用syslog工具。例如,Defaults logfile=/var/log/sudo.log这样的配置。 另外,用户可能想知道如何查看和分析这些日志。除了直接查看日志文件,还可以用journalctl,如果系统使用systemd的话。或者用工具如ausearch,如果启用了auditd。还可能涉及到日志轮转的问题,比如logrotate如何处理这些日志文件,避免它们变得过大。 还有,用户可能有更深层的需求,比如如何增强日志记录,或者如何监控sudo的使用,防止滥用。可能需要指导用户配置更详细的日志记录,或者设置实时报警。比如,修改sudoers文件来记录更多的信息,或者整合日志到SIEM系统里。 需要注意用户的使用场景,可能是系统管理员需要审计,或者是普通用户想了解自己的sudo操作被记录的情况。如果是前者,可能需要提供更详细的配置方法和分析工具;如果是后者,可能更关心如何查看自己的操作记录。 另外,还要考虑不同发行版的差异,比如Debian系和RedHat系的日志路径不同,可能需要分别说明。同时,提醒用户权限问题,查看日志可能需要root权限,所以使用sudo或者切换到root用户。 最后,可能存在的误区是用户认为所有sudo日志都在同一个文件里,但实际上可能分散在不同的地方,或者被syslog处理到不同的位置。需要提醒用户检查具体的syslog配置,或者使用统一的日志管理工具。 总结下来,回答的结构应该是:首先介绍sudo日志的作用,然后说明日志的位置和查看方法,接着讲解日志内容的格式,如何配置日志选项,最后提到相关的工具和进阶使用方法。同时,给出具体的例子和命令,让用户能够直接操作。还要注意覆盖不同的系统和可能的问题,确保回答全面且实用。</think>关于 `sudo` 命令产生的日志,以下是分步说明: --- ### 一、**sudo日志的作用** `sudo` 用于临时赋予普通用户管理员权限,其日志记录了: - **执行命令的用户**(原用户和目标用户,如 `root`) - **执行时间** - **具体执行的命令** - **执行结果**(成功或失败) 通过日志审计系统操作、排查问题或追踪异常行为。 --- ### 二、**日志存储位置** 1. **默认日志文件** - 大多数 Linux 系统将 `sudo` 日志记录到系统日志服务(如 `syslog` 或 `rsyslog`)中。 - 具体路径因发行版而异: - **Ubuntu/Debian**: `/var/log/auth.log` - **CentOS/RHEL**: `/var/log/secure` 2. **快速查看方法** 使用 `grep` 过滤 `sudo` 相关记录: ```bash sudo grep sudo /var/log/auth.log # Debian/Ubuntu sudo grep sudo /var/log/secure # CentOS/RHEL ``` --- ### 三、**日志内容示例** 一条典型的 `sudo` 日志如下: ``` May 25 10:00:00 hostname sudo: user1 : TTY=pts/0 ; PWD=/home/user1 ; USER=root ; COMMAND=/usr/bin/apt update ``` - **字段解析** - `user1`: 执行命令的原始用户 - `USER=root`: 目标用户(通过 `-u` 指定,默认为 `root`) - `COMMAND`: 实际执行的命令 --- ### 四、**自定义日志配置** 1. **独立日志文件** 在 `/etc/sudoers` 中添加配置,将日志写入独立文件: ```bash Defaults logfile="/var/log/sudo.log" ``` (需通过 `visudo` 命令安全编辑此文件) 2. **增强日志细节** 添加 `log_input` 和 `log_output` 记录输入输出: ```bash Defaults log_input, log_output ``` --- ### 五、**日志分析工具** 1. **基础分析** - 按用户过滤: ```bash sudo grep "user1" /var/log/auth.log ``` - 按时间范围过滤: ```bash sudo journalctl --since "2023-05-25 09:00:00" --until "2023-05-25 10:00:00" | grep sudo ``` 2. **高级工具** - **`ausearch`**(需启用 `auditd` 服务): ```bash sudo ausearch -m USER_CMD -ts recent ``` - **`logwatch`**:生成日志摘要报告 ```bash sudo logwatch --range Today --service sudo ``` --- ### 六、**注意事项** 1. **权限问题** 查看日志需 `root` 权限,例如使用 `sudo less /var/log/auth.log`。 2. **日志轮转** 日志文件会被 `logrotate` 定期压缩清理,历史记录可在 `/var/log/auth.log.1.gz` 等归档文件中找到。 --- ### 七、**安全建议** - 定期检查 `sudo` 日志,监控可疑操作。 - 对敏感命令配置实时告警(如通过 `auditd` 规则)。 - 限制用户 `sudo` 权限(通过 `/etc/sudoers` 配置最小权限原则)。 如有进一步需求,可提供具体场景深入探讨!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值