The Hive
GitHubLinkedInEmail
  • šŸ Home
  • 🌐RECON
    • šŸ“”Passive (OSINT)
      • ā©Metadata
      • ā©Social Platforms
        • Email
        • Tumbler
        • Redit
        • Github
        • Tinder
        • TikTok
        • Snapchat
        • Instagram
        • Facebook
        • Twitter
        • Google
        • LinkedIn
    • šŸ“”Active
      • ā©Host Discovery / Network Mapping
      • ā©nmap cheat sheet
      • ā©masscan cheat sheet
    • šŸ“”Web Recon
      • ā©Web Server Discovery
      • ā©Hidden Hosts
      • ā©Directories & Subdomains
      • ā©SSL Certs
      • ā©CMS
      • ā©WAF Detection
    • šŸ“”Firewall Evasion
  • šŸ“—Web Attacks
    • 🟢Server Side
      • 🟩Authentication Mechanisms
      • 🟩Access Control (Authorization)
      • 🟩Directory Traversal
      • 🟩OS Command Injection
      • 🟩Server-Side Request Forgery (SSRF)
      • 🟩XML External Entity (XXE) Injection
      • 🟩File Upload
      • šŸ”§SQL Injection
      • 🟩Information Disclosure
      • 🟩Business Logic
    • 🟢Client Side
      • 🟩Cross-site request forgery (CSRF)
      • šŸ”§Cross-site scripting (XSS)
  • šŸ“’Network attacks
    • 🟔Network Services
      • 🟨Brute Force
      • 🟨DNS
      • 🟨IPv6
      • 🟨FTP
      • 🟨SSH
      • 🟨SMB
      • 🟨SNMP
      • 🟨SMTP
      • 🟨POP3
      • 🟨IMAP
      • 🟨MSSQL
      • 🟨MySQL
      • 🟨MSRPC / RPCbind
      • 🟨LDAP
      • 🟨NTP
      • 🟨NFS
      • 🟨Telnet
      • 🟨WebDAV
      • 🟨RDP
      • 🟨RSIP
      • 🟨Rlogin
      • 🟨VPNs
      • 🟨Echo
      • šŸ”§RTP
      • šŸ”§VOIP
        • SIP
    • 🟔Network Devices
      • 🟨IPv6 Attacks
        • Neighbor Impersonation
        • Router Advertisement Flooding
      • 🟨Switch Attacks
        • Cisco Exploitation
        • STP Spoofing
        • VLAN Hopping
        • MAC Flood
      • 🟨Router Attacks
        • Router Exploitation
        • HSRP Hijacking
        • šŸ”§RIP Spoofing
        • šŸ”§OSPF Attacks
        • šŸ”§VRRP MitM
      • 🟨NAC Bypass
        • Captive Portal
        • 802.1X / EAP Bypass
      • 🟨Printer Exploitation
    • 🟔MITM & Poisoning
      • 🟨Bettercap
      • 🟨HTTPS Downgrade / HSTS Bypass
      • 🟨Session Hijackings
      • 🟨Malicious Update
      • 🟨RDP Downgrade
      • 🟨DNS Spoofing
      • 🟨NTP Spoofing
      • 🟨ARP Spoofing
      • 🟨DHCP Poisoning
      • 🟨DHCPv6 Spoofing
      • 🟨SSDP Spoofing
      • 🟨WSUS Spoofing
      • 🟨ADIDNS Poisoning
      • 🟨WPAD Abuse
    • 🟔Wireless Attacks
      • 🟨Protocol Concepts
      • 🟨Basics
      • 🟨Attacks
    • 🟔Sniffing
      • 🟨Wireshark
      • 🟨tcpdump
    • 🟔Denial of Service
  • šŸ“•Red Team
    • šŸ”“Windows
      • ā­•Security Concepts
        • Windows Security Components
        • Active Directory Components
        • Kerberos
        • Loggon Sessions and Access Tokens
        • Permissions and Access Control
        • Windows Registry
        • Object Management
      • ā­•Physical Attack
      • ā­•Enumeration
      • ā­•Privilege Escalation
        • DLL Hijacking
          • Phantom DLL Hijacking / Replacement
          • Search Order Hijacking ( Preloading )
          • DLL Side-Loading
        • Service Misconfigurations
          • Weak Registry Permissions
          • Insecure Service Executables
          • Insecure Permission
          • Unquoted Service Path
        • Creating a New Service (admin to system)
        • Registry
          • AlwaysInstallElevated
          • AutoRuns
        • Scheduled Tasks
        • Mass Roll-outs
        • Startup Apps
        • Installed Applications
        • Loopback Services
        • Insecure GUI APPs
        • Potatos
        • Printspoofer / SEImpersonate
        • PSEXEC (admin to system)
      • ā­•Credential Dumping
      • ā­•Persistence
        • Invisible Account Forger
        • Add User
        • Scheduled Tasks
        • Run Registry Keys
        • Logon Scripts
        • Screensavers Hijack
        • Powershell Profiles & Modules
        • Service Creation/Modification
        • Shortcut Modification
        • Startup Folder
        • RDP backdoors
        • COM Hijacking
    • šŸ”“Active Directory
      • ā­•Domain Enumeration
      • ā­•Tools & Frameworks
        • Evil-WinRM
        • CME cheat sheet
        • SharpSploit
        • impacket cheat sheet
        • DeathStar
      • ā­•Exploitation
        • LLMNR Poisoning
        • SMB/NTLM Relay
        • DNS Takeover + LDAP Relay
        • Cracking Hashes
        • Password spraying
        • ADCS + PetitPotam NTLM Relay
        • EternalBlue
        • ZeroLogon
        • MS Exchange ProxyShell
        • MS Exchange ProxyLogon
        • Java JBOSS
      • ā­•Privilege Escalation
        • Token Impersonation
        • DNS Admins
        • AD CS Abuse
        • ACL Abuse
          • GenericAll
          • Write Property
          • Self-membership
          • ForceChangePassword
          • Managed Security Groups
          • Exchange Windows Permissions
        • Group Policy Objects (GPOs)
        • Custom SSPs
        • PrintNightmare
      • ā­•Lateral Movement
        • RDP Password Decryption
        • RDP Session Hijacking
        • headless RDP with SharpRDP
        • Domain Shares
        • SCF File Attacks
        • Pass the Hash / Password
        • Overpass the Hash / Pass the Key
        • Pass The Ticket
        • Kerberosting / AS-REP Rosting
        • Kerberos Delegation
      • ā­•Credential Dumping
        • CredSSP / TSPKG
        • Wdigest Clear Text
        • DPAPI secrets
        • SAM & Registry
        • NTDS.dit & vshadow
        • comsvcs.dll
        • Meterpreter
        • Procdump & LSASS
        • AD User Comments
        • SYSVOL & Group Policy Preferences
        • LAPS Passwords
        • GSMA Passwords
        • HiveNightmare
        • Mimikatz Cheat sheet
        • Other Tools / Techniques
      • ā­•Persistence
        • Certificates
        • DCSync
        • DCShadow
        • Silver Ticket
        • Golden Ticket
        • Skeleton Key
        • WMI
        • PowerShell Remoting
        • Remote Registry
        • Rights Abuse
        • AdminSDHolder
        • DSRM
        • Kerberos Checksum Validation ( MS14-068 )
    • šŸ”“Linux
      • ā­•Physical Attacks
      • ā­•Enumeration
      • ā­•Privilege Escalation
        • SUID / SGID abuse
        • /etc/shadow & /etc/passwd
        • cron/crontab abuse
        • Sudo Abuse
        • Capabilities Abuse
        • Environment Variables
          • LD_LIBRARY_PATH
          • LD_PRELOAD
        • Shared Object Injection
        • NFS
        • man CE Pager Argument
        • MySQL UDF
        • UDEVD
        • STDIN/STDOUT
        • Unix Socket Exploitation
        • Dirty Pipe
        • Docker
          • SUID Docker
      • ā­•Lateral Movement
        • Infecting Running Processes
        • VIM Config File Keylogger
        • SSH Hijacking
        • Samba Secrets to Domain Admin
        • Hiding Processes
        • Simple User-mode Rootkits
        • Vino VNC Server
      • ā­•Credential Dumping
        • Swap Dump
        • mimipinguin
        • unshadow
        • 3snake
      • ā­•Persistence
        • Startup User File Backdoor
        • PHP Backdoor
        • Apache mod_rootme
        • Startup Service Backdoor
        • xdg Backdoor
        • rootbash SUID
        • apt Backdoor
        • Driver Backdoor
        • Core Pattern
        • dash Backdoor
        • Creating an SUID Binary
        • Systemd netcat bind shell
        • Xinetd UDP portnock
        • openSSL reverse shell
        • motd Backdoor
        • Auth Log Backdoor
        • RSYSLOG Backdoor
        • sshd Backdoor
        • VIM Config Backdoor
        • .bashrc Backdoor
        • Adding a Root user
        • Crontab Reverse Shell
        • SSH persistence password-less
      • ā­•Covering Tracks
    • šŸ”“Command & Control (C2)
      • ā­•Cobalt Strike
      • ā­•Metasploit
      • ā­•Empire & Starkiller
      • ā­•Covenant
    • šŸ”“Shells and Payloads
      • ā­•Shell Escape / Interactive Shell
      • ā­•LOL Binaries
      • ā­•msfvenom
      • ā­•SharpShooter & Ivy
      • ā­•Other Payloads
    • šŸ”“Payload Delivery
      • ā­•Powershell Reflective DLL Load
      • ā­•HTML Smuggling
      • ā­•Office Macros
      • ā­•DDE Auto - Word/Excel
      • ā­•.SLK Excel
      • ā­•XLM Macro 4.0
      • ā­•LNK
      • ā­•embedded OLE + LNK objects
      • ā­•JScript
      • ā­•HTA
      • ā­•VBS
      • ā­•VBA
      • ā­•RTF
      • ā­•REG
      • ā­•MSI / MSIEXEC
      • ā­•IQY
      • ā­•CHM / HHC
      • ā­•SCR
    • šŸ”“Pivoting
      • ā­•SSH Forwarding
      • ā­•Socat Stealth Port Forward
      • ā­•Socat Reverse Shell Relay
      • ā­•HTTP Tunneling
      • ā­•ICMP Tunneling
      • ā­•DNS Tunneling
      • ā­•Metasploit Pivoting
      • ā­•Cobalt Strike Pivoteing
      • ā­•VPN Tunneling
      • ā­•Other Tools
    • šŸ”“Exfiltration / File Transfer
      • ā­•Encode / Decode Files
      • ā­•TCP / UDP
      • ā­•DNS
      • ā­•SSH
      • ā­•ICMP
      • ā­•SMB
      • ā­•FTP
      • ā­•HTTP
      • ā­•Other Methods
    • šŸ”“Password Attacks
      • ā­•Online Attacks
      • ā­•Offline Attack
      • ā­•Word List
      • ā­•Cheat Sheet
    • šŸ”“Defense Evasion
      • ā­•Basic Tricks
      • šŸ”§Powershell Tricks
      • ā­•Disabling Defenses
      • ā­•UAC Bypass
      • ā­•Process Migration
      • ā­•Dechaining Macros
      • ā­•VBA Sandbox Evasion
      • ā­•AMSI Bypass
      • ā­•SRP & AppLocker Bypass
      • ā­•GPO Bypass
  • šŸ“˜Blue Team
    • šŸ”µThreat Modeling / Hunting / Intelligence
    • šŸ”µLinux Hardening
      • šŸ”¹OS Security
        • Update Strategy
        • Service Management
        • Physical Security
        • Grub Hardening
        • Kernel Parameters
        • Process Isolation
      • šŸ”¹Accounts & Passwords
        • Users & Groups
        • Password Security & Sudoers
      • šŸ”¹Access Control & Ownership
      • šŸ”¹File System Security
      • šŸ”¹Integrity Check
      • šŸ”¹Sandboxing
      • šŸ”¹Network
      • šŸ”¹iptables
        • Rule Sets
      • šŸ”¹Service Hardening
        • BIND9
        • vsftpd
        • Nginx
        • Apache
        • SSH
      • šŸ”¹System Audit
      • šŸ”¹Logging
        • auditd
      • šŸ”¹Encryption
    • šŸ”µSecurity Architecture
      • šŸ”¹Layered Security
  • 🟪Purple Teaming
    • 🟣Adversary Emulation
  • 🟧programming
    • 🟠C Programming
      • šŸ”øBasic Structure
      • šŸ”øGCC Compiler
      • šŸ”øPreprocessors
      • šŸ”øData Types
      • šŸ”øType Qualifiers
      • šŸ”øPointers
      • šŸ”øDynamic Memory Allocation
      • šŸ”øLoops
      • šŸ”øConditional Statements
      • šŸ”øFunctions
      • šŸ”øInput / Output
      • šŸ”øMacros
      • šŸ”øFiles
      • šŸ”øStrings Manipulation
      • šŸ”øBit Manipulation
      • šŸ”øData Structures
        • Arrays
        • Structures
        • Unions
      • šŸ”øAbstract Data Types
        • Stack
        • Queue
        • Linked List
          • Singly Linked List
          • Doubly Linked List
      • šŸ”øLibraries & Linking
      • šŸ”øError Recovery
    • šŸ”§Assembly ( NASM )
      • Intel IA-32 Environment
      • Basic Structure
      • Variables and Data Types
      • Most-used Instructions
      • input / output
  • 🟫Miscellaneous
    • 🟤GNU Screen / tmux
    • 🟤SSH Tricks
    • 🟤Cats
      • netcat
      • ncat
      • pwncat
      • socat
      • šŸ”§powercat
    • 🟤Curl
    • 🟤Cross-compiling Binaries
Powered by GitBook
On this page
  • How File Integrity Checkers work
  • File Attributes
  • AIDE
  • Creating an Audit Database
  • Initiate the Database
  • Check Integrity
  • Update the DB
  • Config Files
  • Scheduling
  1. Blue Team
  2. Linux Hardening

Integrity Check

PreviousFile System SecurityNextSandboxing

Last updated 2 years ago

How File Integrity Checkers work

Generally, file integrity checkers work in two phases. The first phase consists of generating a database made up of cryptographically strong hashes for all the critical files on a host. You can think of these hashes as being a unique fingerprint for each file; it’s impossible to change the file without changing its fingerprint. The database usually also contains additional file information such as size, ownership, permissions and modification dates for each file.

In the second phase, once an initial copy of this database is built (the Initial Baseline) the same calculation is periodically recalculated for the same critical files on the host. If a file has been tampered with (let’s say by an attacker who has compromised the host), one of these characteristics will have changed. Detecting these changes will allow the tampered file to be identified, providing a warning of the system compromise.

File Attributes

Inode Number: This is a unique integer that can be used to index into a data structure (known as an ā€œinodeā€) that specifies many of the attributes of an active file on a file system. If a file’s inode number changes, that means the file has been deleted and a new file created using the same name as the old one.

Type: Indicates whether the file is a data file, or a special file such as a named pipe or an interface to a device.

Owner: Unix associates a unique owner (a Unix account) to each file.

Group: Unix supports an object that collects multiple Unix accounts into a single entity, known as a ā€œgroupā€. Unix associates a single group with every file.

Permission: Every file in unix has permission (Read, Write, Execute)

Timestamps: Three dates are associated with each file. They are the date and time the file’s data was last modified, when the file’s attributes (including its data) was last modified and the time it was last read.

Size: How large the file is, in bytes. Special files will be zero bytes in size.

Some Commonly Used Integrity Checkers:

  • TripWire

  • Advanced Intrusion Detection Environment (AIDE)

  • OSSEC

AIDE

Creating an Audit Database

Install AIDE:

apt install aide aide-common

Initiate the Database

# with default config file in /etc/aide.conf
aide -i

# with custom config file
aide --config=/var/aide/aide.conf --init

While initializing the database aide will take an snapshot of all system libraries and binaries for future compare to see if anything changed or not copy the new created db in /var/lib/aide aide.db.new.gz to aide.db.gz do a check for all files for mismatches:

replace the old database with the new one:

mv /var/aide/aide.db.new.gz /var/aide/aide.db.gz

Check Integrity

# with default config file
aide --check

# with custom config file
aide --config=/var/aide/aide.conf --check

if there was a change we will see a warning

Update the DB

Updating the aide DB after checking the aide db:

/aide -c aide.conf --update

This will reset the database to the current status of the /etc/sub-director

Config Files

conf file: /etc/aide.conf

log file: /etc/log/aide

db: /etc/lib/aid

Scheduling

determine if there is a cron job scheduled to run the aide check:

Run the following command:

crontab -u root -e

Add the following line to the crontab:

 0 5 * * * /usr/bin/aide.wrapper --config /etc/aide/aide.conf --check
šŸ“˜
šŸ”µ
šŸ”¹
ChapterĀ 11.Ā Checking integrity with AIDE Red Hat Enterprise Linux 8 | Red Hat Customer PortalRed Hat Customer Portal
Logo