Back to Wazuh

Flatbuffers

docs/ref/modules/utils/flatbuffers/README.md

4.14.532.8 KB
Original Source

Flatbuffers

Various modules, such as the Vulnerability Detector and Inventory Harvester, use FlatBuffers. FlatBuffers is a library that enables high-performance data serialization and deserialization without the need of unpacking or parsing, providing direct access to the required information.

Although the synchronization events received by Remoted are in JSON format, they require to augmentate the event data with additional agent context within this module. As a result, deserializing and re-serializing the data becomes unavoidable. Given this requirement, the augmented synchronization events—processed through dbsync and rsync—are converted to FlatBuffers.

Another key use of FlatBuffers in the Vulnerability Detector module is for processing vulnerability feeds, specifically those following the CVE5 schema. In this case, FlatBuffers are used to avoid the deserialization overhead during scanning.

Due to the nature of FlatBuffers, the deserialization cost is significantly lower compared to JSON, regardless of the JSON library used. This makes FlatBuffers particularly well-suited for scanning operations, where deserialization performance is a critical factor.

For the inventory harvester the data is converted into FlatBuffers and send it to wazuh-modulesd through the router module(IPC).

Flatbuffer schemas

Common AgentInfo table

  • Common agent information for FIM Delta, Inventory Delta and Synchronization events.
TableFieldTypeDescription
AgentInfoagent_idstringUnique identifier of the agent, e.g., "001".
agent_ipstringIP address of the agent.
agent_namestringName assigned to the agent.
agent_versionstringVersion of the agent software, e.g., "v4.10.2".

FIM Delta table

  • Main table in flatbuffer schema for FIM Delta events.
TableFieldTypeDescription
Deltaagent_infoAgentInfoMetadata about the agent generating the event.
data_typestringNature of the event, e.g., "event".
dataDataDetailed data about the detected change.

FIM Data table

  • Data table for FIM delta events.
TableFieldTypeDescription
DataattributesAttributesDetailed attributes of the event.
pathstringAbsolute file path or full registry key path.
indexstringIndex of the entity.
modestringMonitoring mode, either "Scheduled" or "Realtime".
typestringType of change detected, e.g., "added", "modified", "deleted".
archstringRegistry architecture type, e.g., "[x86]", "[x64]".
timestamplongTimestamp when the event was generated.
value_namestringName of the registry value.

FIM Attributes table

  • Attributes table for FIM delta events.
TableFieldTypeDescription
AttributestypestringType of monitored entity, e.g., "registry_value", "registry_key", "file".
uidstringUser ID associated with the entity.
user_namestringName of the owner of the entity (user).
gidstringGroup ID associated with the entity.
group_namestringName of the group that owns the entity.
inodelongInode number (only applicable for file events).
mtimelongLast modified timestamp of the entity.
sizelongSize of the file or registry value (in bytes).
value_typestringType of the registry value, e.g., "REG_SZ", "REG_DWORD".
value_namestringName of the registry value.
hash_md5stringMD5 hash of the file or registry value content.
hash_sha1stringSHA-1 hash of the file or registry value content.
hash_sha256stringSHA-256 hash of the file or registry value content.

Inventory Delta table

  • Main table in flatbuffer schema for inventory Delta events.
TableFieldTypeDescription
Deltaagent_infoAgentInfoInformation about the agent.
dataProviderData changes in the agent.
operationstringType of operation performed (e.g., INSERTED, MODIFIED, DELETED).

Inventory Provider union table

  • Provider union table for inventory delta events.
TableTypeDescription
Provider (Union)dbsync_network_ifaceNetwork interfaces description.
dbsync_network_protocolNetwork protocol configuration for detected interfaces.
dbsync_network_addressNetwork address information for detected interfaces.
dbsync_osinfoHost operating system.
dbsync_hwinfoHardware information.
dbsync_portsListening ports.
dbsync_packagesInstalled packages.
dbsync_hotfixesInstalled hotfixes.
dbsync_processesRunning processes.
dbsync_usersOperating system users.
dbsync_groupsOperating system groups.
dbsync_servicesOperating system services and daemons.
dbsync_browser_extensionsInstalled web browser extensions.

Inventory providers

  • Provider tables for inventory delta events.
TableFieldTypeDescription
dbsync_hotfixeshotfixstringName or identifier of the applied hotfix.
dbsync_hwinfoboard_serialstringSerial number of the motherboard.
cpu_namestringName/model of the CPU.
cpu_coreslongNumber of CPU cores.
cpu_mhzdoubleCPU clock speed in MHz.
ram_totallongTotal RAM available in the system (MB).
ram_freelongFree RAM available in the system (MB).
ram_usagelongRAM usage in percentage.
dbsync_network_addressifacestringNetwork interface name.
protolongProtocol type (e.g., IPv4, IPv6).
addressstringAssigned IP address.
netmaskstringSubnet mask of the interface.
broadcaststringBroadcast address.
item_idstringUnique identifier for the network address entry.
metricstringInterface metric for routing decisions.
dhcpstringIndicates whether DHCP is enabled (yes/no).
dbsync_network_ifacenamestringInterface name.
adapterstringAdapter type (e.g., Ethernet, WiFi).
typestringNetwork interface type.
statestringCurrent state (e.g., up, down).
mtulongMaximum Transmission Unit (MTU).
macstringMAC address of the interface.
tx_packetslongNumber of transmitted packets.
rx_packetslongNumber of received packets.
tx_byteslongNumber of bytes transmitted.
rx_byteslongNumber of bytes received.
tx_errorslongNumber of transmission errors.
rx_errorslongNumber of reception errors.
tx_droppedlongNumber of dropped outgoing packets.
rx_droppedlongNumber of dropped incoming packets.
item_idstringUnique identifier for the interface entry.
dbsync_network_protocolifacestringInterface name.
typestringProtocol type (e.g., static, dynamic).
gatewaystringDefault gateway address.
dhcpstringIndicates if DHCP is used (yes/no).
metricstringRouting metric value.
item_idstringUnique identifier for the protocol entry.
dbsync_osinfohostnamestringSystem hostname.
architecturestringCPU architecture (e.g., x86_64, ARM).
os_namestringOperating system name.
os_versionstringFull OS version.
os_codenamestringOS codename (if applicable).
os_majorstringMajor version number.
os_minorstringMinor version number.
os_patchstringPatch level of the OS.
os_buildstringBuild number of the OS.
os_platformstringPlatform name (e.g., Debian, RedHat).
sysnamestringSystem kernel name.
releasestringKernel release version.
versionstringKernel version.
os_releasestringDistribution-specific release information.
os_display_versionstringHuman-readable OS version.
dbsync_portsprotocolstringTransport protocol (TCP/UDP).
local_ipstringLocal IP address.
local_portlongLocal port number.
remote_ipstringRemote IP address.
remote_portlongRemote port number.
tx_queuelongTransmit queue length.
rx_queuelongReceive queue length.
inodelongInode associated with the connection.
statestringConnection state (e.g., LISTEN, ESTABLISHED).
pidlongProcess ID using the port.
processstringName of the process using the port.
item_idstringUnique identifier for the port entry.
dbsync_processespidstringProcess ID.
namestringProcess name.
statestringCurrent process state.
ppidlongParent process ID.
utimelongUser mode CPU time used.
stimelongSystem mode CPU time used.
cmdstringCommand executed by the process.
argvsstringArguments passed to the process.
euserstringEfective user.
ruserstringReal user.
suserstringSaved-set user.
egroupstringEffective group.
rgroupstringReal group.
sgroupstringSaved-set group.
fgroupstringFilesystem group name.
prioritylongKernel scheduling priority.
nicelongNice value of the process.
sizelongTotal size of the process.
vm_sizelongTotal VM size (KB).
residentlongResident set size of the process (KB).
sharelongShared memory.
start_timelongTime when the process started.
pgrplongProcess group.
sessionlongSession of the process.
nlwplongNumber of light weight processes.
tgidlongThread Group ID.
ttylongNumber of TTY of the process.
processorlongNumber of the processor.
dbsync_packagesnamestringPackage name.
versionstringPackage version.
vendorstringVendor or maintainer of the package.
install_timestringInstallation timestamp.
locationstringPath where the package is installed.
architecturestringPackage architecture.
groupsstringPackage category or group.
descriptionstringDescription of the package.
sizelongSize of the package in bytes.
prioritystringPriority of the package.
multiarchstringMultiarchitecture support.
sourcestringSource of the package.
formatstringFormat of the package.
item_idstringUnique identifier for the package entry.
dbsync_usersuser_namestringUser name.
user_full_namestringFull name of the user.
user_homestringHome directory of the user.
user_idlongUser ID.
user_uid_signedlongSigned user ID.
user_uuidstringUser UUID.
user_groupsstringGroups the user belongs to.
user_group_idlongGroup ID.
user_group_id_signedlongSigned group ID.
user_createddoubleAccount creation time.
user_rolesstringUser roles.
user_shellstringUser shell.
user_typestringType of user.
user_is_hiddenboolWhether the user is hidden.
user_is_remoteboolWhether the user is remote.
user_last_loginlongLast login timestamp.
user_auth_failed_countlongNumber of failed authentication attempts.
user_auth_failed_timestampdoubleTimestamp of last failed authentication.
user_password_expiration_dateintPassword expiration date.
user_password_hash_algorithmstringPassword hash algorithm.
user_password_inactive_daysintInactive days before password expires.
user_password_last_changedoubleLast password change timestamp.
user_password_max_days_between_changesintMax days between password changes.
user_password_min_days_between_changesintMin days between password changes.
user_password_statusstringPassword status.
user_password_warning_days_before_expirationintWarning days before password expiration.
process_pidlongAssociated process PID.
host_ipstringHost IP address.
login_statusboolLogin status.
login_ttystringLogin TTY.
login_typestringLogin type.
dbsync_groupsgroup_idlongGroup ID.
group_namestringGroup name.
group_descriptionstringGroup description.
group_id_signedlongSigned group ID.
group_uuidstringGroup UUID.
group_is_hiddenboolWhether the group is hidden.
group_usersstringUsers in the group.
dbsync_browser_extensionsbrowser_namestringName of the browser.
user_idstringUser ID.
package_namestringExtension package name.
package_idstringExtension package ID.
package_versionstringExtension version.
package_descriptionstringDescription of the extension.
package_vendorstringVendor of the extension.
package_build_versionstringBuild version of the extension.
package_pathstringPath to the extension.
browser_profile_namestringBrowser profile name.
browser_profile_pathstringBrowser profile path.
package_referencestringReference for the extension.
package_permissionsstringPermissions required by the extension.
package_typestringType of the extension.
package_enabledboolWhether the extension is enabled.
package_autoupdateboolWhether auto-update is enabled.
package_persistentboolWhether the extension is persistent.
package_from_webstoreboolWhether the extension is from a webstore.
browser_profile_referencedboolWhether the profile is referenced.
package_installedstringInstallation status.
file_hash_sha256stringSHA-256 hash of the extension file.
dbsync_servicesnamestringService name or unit name.
display_namestringDisplay name of the service.
descriptionstringDescription of the service/unit.
service_typestringType of service (e.g., OWN_PROCESS).
start_typestringStart type (e.g., AUTO_START, DEMAND_START).
statestringCurrent state (e.g., RUNNING, STOPPED, active).
pidlongProcess ID of the running service.
ppidlongParent process ID.
binary_pathstringPath to the service executable or unit file.
load_statestringLoad state of the unit.
active_statestringActive state of the unit.
sub_statestringLow-level systemd substate.
unit_file_statestringWhether the unit is enabled/disabled.
statusstringService status information.
userstringUser account running the service.
can_stopstringWhether the service can be stopped.
can_reloadstringWhether the service can be reloaded.
service_exit_codelongService-specific exit code on failure.
service_namestringECS: service.name (File name of plist for macOS).
process_executablestringECS: process.executable (Path to the service executable).
process_argsstringECS: process.args (Command line arguments for the service).
file_pathstringECS: file.path (Path to the .plist definition file for macOS).
process_user_namestringECS: process.user.name (User account running the job).
process_group_namestringECS: process.group.name (Group account running the job).
service_enabledstringECS: service.enabled (unified as text: enabled/disabled for Linux, true/false for macOS).
service_restartstringCustom: service.restart (Restart policy: always/on-failure/never).
service_frequencylongCustom: service.frequency (Run frequency in seconds).
log_file_pathstringCustom: log.file.path (Redirect stdout to a file/pipe).
error_log_file_pathstringCustom: error.log.file.path (Redirect stderr to a file/pipe).
process_working_directorystringECS: process.working_directory (Working directory of the job).
process_root_directorystringCustom: process.root_directoryectory (Chroot directory before execution).
service_starts_on_mountboolCustom: service.starts_on_mount (Launch when a filesystem is mounted).
service_starts_on_path_modifiedstringCustom: service.starts_on_path_modified (Launch when a path is modified).
service_starts_on_not_empty_directorystringCustom: service.starts_on_not_empty_directory (Launch when a directory is not empty).
service_inetd_compatibilityboolCustom: service.inetd_compatibility (Indicates if the daemon expects to be run as if it were launched from inetd).

SyncMsg table

  • Main table in flatbuffer schema for synchronization events.
TableFieldTypeDescription
SyncMsgagent_infoAgentInfoEvent type description.
dataDataUnionData changes in the agent.

DataUnion table union

  • DataUnion table union for synchronization events.
TableTypeDescription
DataUnion (Union)stateState information for synchronization.
integrity_check_globalGlobal integrity check covering all data/files.
integrity_check_leftIntegrity check for the left data chunk.
integrity_check_rightIntegrity check for the right data chunk.
integrity_clearCommand to clear all integrity data.

State table

  • State event type for synchronization events.
TableFieldTypeDescription
stateattributesAttributesUnionAggregated attributes of the entity.
indexstringIndex of the entity.
pathstringAbsolute path of the file or registry entry.
value_namestringName of the registry value.
archstringSystem architecture (x86, x64).

AttributesUnion table union

  • Different event component types for synchronization events.
TableTypeDescription
AttributesUnionsyscollector_hotfixesEquivalent to dbsync_programs.
syscollector_hwinfoEquivalent to dbsync_hwinfo.
syscollector_network_addressEquivalent to dbsync_network_address.
syscollector_network_ifaceEquivalent to dbsync_iface.
syscollector_network_protocolEquivalent to dbsync_protocol.
syscollector_osinfoEquivalent to dbsync_osinfo.
syscollector_packagesEquivalent to dbsync_packages.
syscollector_portsEquivalent to dbsync_ports.
syscollector_processesEquivalent to dbsync_processes.
syscollector_usersEquivalent to dbsync_users.
syscollector_groupsEquivalent to dbsync_groups.
syscollector_browser_extensionsEquivalent to dbsync_browser_extensions.
syscollector_servicesEquivalent to dbsync_services .
fim_fileFile monitoring.
fim_registry_keyRegistry monitoring key.
fim_registry_valueRegistry monitoring value.

fim_file table

  • fim_file table for file monitoring in synchronization events.
TableFieldTypeDescription
fim_filegidstringGroup ID associated with the file.
group_namestringName of the group that owns the file.
hash_md5stringMD5 hash of the file content.
hash_sha1stringSHA-1 hash of the file content.
hash_sha256stringSHA-256 hash of the file content.
inodelongInode number of the file.
mtimelongLast modified timestamp.
sizelongFile size in bytes.
typestringFile type (e.g., directory, file, symlink).
uidstringUser ID associated with the file.
user_namestringName of the file owner.

fim_registry_key table

  • fim_registry_key table for registry monitoring in synchronization events.
TableFieldTypeDescription
fim_registry_keygidstringGroup ID associated with the registry.
group_namestringName of the group that owns the registry.
mtimelongLast modified timestamp.
uidstringUser ID associated with the registry.
typestringRegistry type.
user_namestringName of the registry owner.

fim_registry_value

  • fim_registry_value table for registry monitoring in synchronization events.
TableFieldTypeDescription
fim_registry_valuehash_md5stringMD5 hash of the registry content.
hash_sha1stringSHA-1 hash of the registry content.
hash_sha256stringSHA-256 hash of the registry content.
sizelongRegistry size in bytes.
typestringRegistry type.