Heisenberg ở Helgoland
-
Đây là bản dịch tiếng Việt của câu bài viết “Heisenberg in Helgoland” của
tác giả Ashutosh Jogalekar. Bài viết nói về một sự kiện xảy ra năm 1925:
Heisenbe...
Monday, May 21, 2018
Tìm hiểu Audit trên linux!!!
Audit là một framework được tích hợp sẵn vào trong nhân linux, cung cấp thông tin chi tiết để thanh tra các hoạt động hệ thống một mức rất chi tiết.
Nó có thể:
1. Giúp người dùng giám sát các tiến trình có nguy hiểm đến hệ thống hay hành vi xảy ra trên hệ thống một các chi tiết
2. Cung cấp chức năng lọc, xây dựng báo cáo để có thể trích xuất thông tin được audit log lưu lại. Chúng ta có thể filter theo các mục sau:
• User
• Group
• AuditID
• RemoteHostname
• RemoteHostAddress
• SystemCall
• SystemCallArguments • File
• FileOperations
• SuccessorFailure
• Group
• AuditID
• RemoteHostname
• RemoteHostAddress
• SystemCall
• SystemCallArguments • File
• FileOperations
• SuccessorFailure
Auditing goals
By using a powerful audit framework, the system can track many event types to monitor and audit the system. Examples include:
- Audit file access and modification
- See who changed a particular file
- Detect unauthorized changes
- Monitoring of system calls and functions
- Detect anomalies like crashing processes
- Set tripwires for intrusion detection purposes
- Record commands used by individual users
Components
The framework itself has several components:
Kernel:
- audit: hooks into the kernel to capture events and deliver them to auditd
Binaries:
- auditd: daemon to capture events and store them (log file)
- auditctl: client tool to configure auditd
- audispd: daemon to multiplex events
- aureport: reporting tool which reads from log file (auditd.log)
- ausearch: event viewer (auditd.log)
- autrace: using audit component in kernel to trace binaries
- aulast: similar to last, but instaed using audit framework
- aulastlog: similar to lastlog, also using audit framework instead
- ausyscall: map syscall ID and name
- auvirt: displaying audit information regarding virtual machines
Files:
- audit.rules: used by auditctl to read what rules need to be used
- auditd.conf: configuration file of auditd
Thành phần của Audit
Các thành phần của Audit |
Audit.rules là file chứa các luật sẽ được tải khi khởi động audit daemon. Chương trình auditctl được sử dụng cho kịch bản khởi tạo hành vi này. cấu trúc luật gồm 3 phần: control, file và syscall.
Control
Control commands generally involve configuring the audit system rather than telling it what to watch for. These commands typically include deleting all rules, setting the size of the kernel's backlog queue, setting the failure mode, setting the event rate limit, or to tell auditctl to ignore syntax errors in the rules and continue loading. Generally, these rules are at the top of the rules file.File System
File System rules are sometimes called watches. These rules are used to audit access to particular files or directories that you may be interested in. If the path given in a watch rule is a directory, then the rule used is recursive to the bottom of the directory tree excluding any directories that may be mount points. The syntax of these watch rules generally follow this format:-w path-to-file -p permissions -k keyname
- r
- - read of the file
- w
- - write to the file
- x
- - execute the file
- a
- - change in the file's attribute
System Call
The system call rules are loaded into a matching engine that intercepts each syscall that all programs on the system makes. Therefore it is very important to only use syscall rules when you have to since these affect performance. The more rules, the bigger the performance hit. You can help the performance, though, by combining syscalls into one rule whenever possible.-a action,list -S syscall -F field=value -k keyname
- always
- - always create an event
- never
- - never create an event
Một số link tham khảo hay:
1. Mô tả rule của Audit https://jlk.fjfi.cvut.cz/arch/manpages/man/audit.rules.7
2. Cấu hình cơ bản Audit https://linux-audit.com/configuring-and-auditing-linux-systems-with-audit-daemon/
3. Sách về Audit https://www.suse.com/documentation/sled10/pdfdoc/audit_sp2/audit_sp2.pdf
Tuesday, May 15, 2018
Các phương pháp update firmware cho thiết bị Router!
Cách 1. Cập nhật qua các chức năng hỗ trợ trên Router, thông thường các web quản trị có sẵn chức năng cập nhật, mình sẽ tả bản firmware từ nhà cung cấp và cập nhật qua kênh này
Cách 2. Cập nhật qua kênh quản trị như console, cổng UART, Debug của thiết bị nếu hỗ trợ
Cách 3. Copy trực tiếp lên firmware thiết bị.
Các này yêu cầu can thiệp sâu vào thiết bị, chúng ta sẽ tách bộ nhớ flash từ Router, sử dụng thiết bị chuyên dụng để ghi dữ liệu vào Flash.
Tải mẫu:
Firmware Router TP-Link WR842ND V2 download từ web
Firmware Router TP-Link WR842ND V2 trích xuất trực tiếp từ flash thiết bị
Cách 2. Cập nhật qua kênh quản trị như console, cổng UART, Debug của thiết bị nếu hỗ trợ
Cách 3. Copy trực tiếp lên firmware thiết bị.
Các này yêu cầu can thiệp sâu vào thiết bị, chúng ta sẽ tách bộ nhớ flash từ Router, sử dụng thiết bị chuyên dụng để ghi dữ liệu vào Flash.
Tải mẫu:
Firmware Router TP-Link WR842ND V2 download từ web
Firmware Router TP-Link WR842ND V2 trích xuất trực tiếp từ flash thiết bị
Saturday, May 12, 2018
Tìm hiểu binwalk
Binwalk là một công cụ phân tích firmware được thiết kế để hỗ trợ trong việc phân tích, khai thác và kỹ thuật djch ngược các firmware hình ảnh. Nó đơn giản để sử dụng, dễ dàng mở rộng thông qua chữ ký tùy chỉnh,....bạn có thể cài đặt nó trên Linux thông qua repo từ Fedora.
Binwal được viết bằng Python 2.7 trong một dự án của Craig Heffner and /dev/ttyS0. Binwalk quét trong bản ảnh firmware, xác định đặc trưng phù hợp với nhiều hệ thống file và địnhj dạng file theo chuẩn công nghiệp. Binwalk cũng có thể trích xuất nhiều thành phần của bản ảnh firmware và hỗ trợ nhiều dạng nén, cũng như trích xuất nhiều nội dung file nén. Công cụ này cũng có thể tạo biểu đồ thể hiện "entropy: của firmware, nó trình bày bằng đồ hoạ các kiểu dữ liệu thực của ảnh, cũng như nhưngx vùng dữ liệu trống hoặc không sử dụng.
Bản mới nhất hiện tại là v2.1.1, hiện tại hỗ trợ trên Linux. Tải Binwalk tại downloading Binwalk from Github, installing it is a matter of the following commands. For the most basic operation, only steps 1 and 2 are required, but if you want the advanced functionality of graphing and extracting compressed firmware volumes you should perform all five steps:
[1] thử binwalk cho FPT box
[2] Cập nhập firmware cho các thiết bị Unifi
[3] Link tải firmware http://tinhaiphong.xyz/category/firmware/
Binwal được viết bằng Python 2.7 trong một dự án của Craig Heffner and /dev/ttyS0. Binwalk quét trong bản ảnh firmware, xác định đặc trưng phù hợp với nhiều hệ thống file và địnhj dạng file theo chuẩn công nghiệp. Binwalk cũng có thể trích xuất nhiều thành phần của bản ảnh firmware và hỗ trợ nhiều dạng nén, cũng như trích xuất nhiều nội dung file nén. Công cụ này cũng có thể tạo biểu đồ thể hiện "entropy: của firmware, nó trình bày bằng đồ hoạ các kiểu dữ liệu thực của ảnh, cũng như nhưngx vùng dữ liệu trống hoặc không sử dụng.
Bản mới nhất hiện tại là v2.1.1, hiện tại hỗ trợ trên Linux. Tải Binwalk tại downloading Binwalk from Github, installing it is a matter of the following commands. For the most basic operation, only steps 1 and 2 are required, but if you want the advanced functionality of graphing and extracting compressed firmware volumes you should perform all five steps:
- sudo python setup.py install
- sudo apt-get install python-lzma
- sudo apt-get install libqt4-opengl python-opengl python-qt4 python-qt4-gl python-numpy python-scipy python-pip
- sudo pip install pyqtgraph
- sudo apt-get install mtd-utils gzip bzip2 tar arj lhasa p7zip p7zip-full cabextract cramfsprogs cramfsswap squashfs-tools
o give you an overview of what this tool is all about, here is the Binwalk help:
Usage: binwalk [OPTIONS] [FILE1] [FILE2] [FILE3] ...
Signature Scan Options:
-B, --signature Scan target file(s) for common file signatures
-R, --raw=<str> Scan target file(s) for the specified sequence of bytes
-A, --opcodes Scan target file(s) for common executable opcode signatures
-m, --magic=<file> Specify a custom magic file to use
-b, --dumb Disable smart signature keywords
-I, --invalid Show results marked as invalid
-x, --exclude=<str> Exclude results that match <str>
-y, --include=<str> Only show results that match <str>
-B, --signature Scan target file(s) for common file signatures
-R, --raw=<str> Scan target file(s) for the specified sequence of bytes
-A, --opcodes Scan target file(s) for common executable opcode signatures
-m, --magic=<file> Specify a custom magic file to use
-b, --dumb Disable smart signature keywords
-I, --invalid Show results marked as invalid
-x, --exclude=<str> Exclude results that match <str>
-y, --include=<str> Only show results that match <str>
Extraction Options:
-e, --extract Automatically extract known file types
-D, --dd=<type:ext:cmd> Extract <type> signatures, give the files an extension of <ext>, and execute <cmd>
-M, --matryoshka Recursively scan extracted files
-d, --depth=<int> Limit matryoshka recursion depth (default: 8 levels deep)
-C, --directory=<str> Extract files/folders to a custom directory (default: current working directory)
-j, --size=<int> Limit the size of each extracted file
-n, --count=<int> Limit the number of extracted files
-r, --rm Delete carved files after extraction
-z, --carve Carve data from files, but don't execute extraction utilities
-e, --extract Automatically extract known file types
-D, --dd=<type:ext:cmd> Extract <type> signatures, give the files an extension of <ext>, and execute <cmd>
-M, --matryoshka Recursively scan extracted files
-d, --depth=<int> Limit matryoshka recursion depth (default: 8 levels deep)
-C, --directory=<str> Extract files/folders to a custom directory (default: current working directory)
-j, --size=<int> Limit the size of each extracted file
-n, --count=<int> Limit the number of extracted files
-r, --rm Delete carved files after extraction
-z, --carve Carve data from files, but don't execute extraction utilities
Entropy Analysis Options:
-E, --entropy Calculate file entropy
-F, --fast Use faster, but less detailed, entropy analysis
-J, --save Save plot as a PNG
-Q, --nlegend Omit the legend from the entropy plot graph
-N, --nplot Do not generate an entropy plot graph
-H, --high=<float> Set the rising edge entropy trigger threshold (default: 0.95)
-L, --low=<float> Set the falling edge entropy trigger threshold (default: 0.85)
-E, --entropy Calculate file entropy
-F, --fast Use faster, but less detailed, entropy analysis
-J, --save Save plot as a PNG
-Q, --nlegend Omit the legend from the entropy plot graph
-N, --nplot Do not generate an entropy plot graph
-H, --high=<float> Set the rising edge entropy trigger threshold (default: 0.95)
-L, --low=<float> Set the falling edge entropy trigger threshold (default: 0.85)
Binary Diffing Options:
-W, --hexdump Perform a hexdump / diff of a file or files
-G, --green Only show lines containing bytes that are the same among all files
-i, --red Only show lines containing bytes that are different among all files
-U, --blue Only show lines containing bytes that are different among some files
-w, --terse Diff all files, but only display a hex dump of the first file
-W, --hexdump Perform a hexdump / diff of a file or files
-G, --green Only show lines containing bytes that are the same among all files
-i, --red Only show lines containing bytes that are different among all files
-U, --blue Only show lines containing bytes that are different among some files
-w, --terse Diff all files, but only display a hex dump of the first file
Raw Compression Options:
-X, --deflate Scan for raw deflate compression streams
-Z, --lzma Scan for raw LZMA compression streams
-P, --partial Perform a superficial, but faster, scan
-S, --stop Stop after the first result
-X, --deflate Scan for raw deflate compression streams
-Z, --lzma Scan for raw LZMA compression streams
-P, --partial Perform a superficial, but faster, scan
-S, --stop Stop after the first result
General Options:
-l, --length=<int> Number of bytes to scan
-o, --offset=<int> Start scan at this file offset
-O, --base=<int> Add a base address to all printed offsets
-K, --block=<int> Set file block size
-g, --swap=<int> Reverse every n bytes before scanning
-f, --log=<file> Log results to file
-c, --csv Log results to file in CSV format
-t, --term Format output to fit the terminal window
-q, --quiet Suppress output to stdout
-v, --verbose Enable verbose output
-h, --help Show help output
-a, --finclude=<str> Only scan files whose names match this regex
-p, --fexclude=<str> Do not scan files whose names match this regex
-s, --status=<int> Enable the status server on the specified port
Tham khảo 1 số tài liệu hay:-l, --length=<int> Number of bytes to scan
-o, --offset=<int> Start scan at this file offset
-O, --base=<int> Add a base address to all printed offsets
-K, --block=<int> Set file block size
-g, --swap=<int> Reverse every n bytes before scanning
-f, --log=<file> Log results to file
-c, --csv Log results to file in CSV format
-t, --term Format output to fit the terminal window
-q, --quiet Suppress output to stdout
-v, --verbose Enable verbose output
-h, --help Show help output
-a, --finclude=<str> Only scan files whose names match this regex
-p, --fexclude=<str> Do not scan files whose names match this regex
-s, --status=<int> Enable the status server on the specified port
[1] thử binwalk cho FPT box
[2] Cập nhập firmware cho các thiết bị Unifi
[3] Link tải firmware http://tinhaiphong.xyz/category/firmware/