All Projects → credativ → pg_snakeoil

credativ / pg_snakeoil

Licence: other
The PostgreSQL Antivirus #pgSnakeOil

Programming Languages

c
50402 projects - #5 most used programming language
Makefile
30231 projects
shell
77523 projects

Projects that are alternatives of or similar to pg snakeoil

Owlyshield
Owlyshield is an EDR framework designed to safeguard vulnerable applications from potential exploitation (C&C, exfiltration and impact))..
Stars: ✭ 281 (+1238.1%)
Mutual labels:  antivirus
AV-Killer
Antivirus Killer
Stars: ✭ 91 (+333.33%)
Mutual labels:  antivirus
antivirus
Useful plugin that will scan your theme templates for malicious injections. Automatically. Every day. For more blog security.
Stars: ✭ 31 (+47.62%)
Mutual labels:  antivirus
antimalwareapp
Anti-malware for Android using machine learning
Stars: ✭ 206 (+880.95%)
Mutual labels:  antivirus
bank mitigations
Anti keylogger, anti screen logger... Strategy to protect with hookings or improve your sandbox with spyware detection... - Demo
Stars: ✭ 17 (-19.05%)
Mutual labels:  antivirus
JustEvadeBro
JustEvadeBro, a cheat sheet which will aid you through AMSI/AV evasion & bypasses.
Stars: ✭ 63 (+200%)
Mutual labels:  antivirus
IAT API
Assembly block for finding and calling the windows API functions inside import address table(IAT) of the running PE file.
Stars: ✭ 63 (+200%)
Mutual labels:  antivirus
Defeat-Defender-V1.2
Powerful batch script to dismantle complete windows defender protection and even bypass tamper protection ..Disable Windows-Defender Permanently....Hack windows. POC
Stars: ✭ 885 (+4114.29%)
Mutual labels:  antivirus
ML-Antivirus
An antivirus powered by machine learning.
Stars: ✭ 32 (+52.38%)
Mutual labels:  antivirus
Batch-Antivirus
Batch Antivirus, a powerful antivirus suite written in batch with real-time protection and heuristical scanning.
Stars: ✭ 26 (+23.81%)
Mutual labels:  antivirus
ClamAV.Managed
ClamAV bindings for the .NET Framework, Mono and PowerShell. ClamAV.Managed is a library written in C# for the .NET Framework and Mono, providing managed bindings for the libclamav interface. It includes ClamAV.Managed.PowerShell, a set of PowerShell cmdlets for ClamAV scanning. It comes with sample code for building a GUI virus scanner applicat…
Stars: ✭ 15 (-28.57%)
Mutual labels:  antivirus
Mail-Toaster-6
Mail Toaster 6
Stars: ✭ 40 (+90.48%)
Mutual labels:  antivirus
MCAntiMalware
Anti-Malware for minecraft
Stars: ✭ 182 (+766.67%)
Mutual labels:  antivirus
Simple-Antirootkit-SST-Unhooker
This is a demo project to illustrate the way to verify and restore original SST in case of some malware hooks
Stars: ✭ 31 (+47.62%)
Mutual labels:  antivirus
window-rat
The purpose of this tool is to test the window10 defender protection and also other antivirus protection.
Stars: ✭ 59 (+180.95%)
Mutual labels:  antivirus
Judge-Jury-and-Executable
A file system forensics analysis scanner and threat hunting tool. Scans file systems at the MFT and OS level and stores data in SQL, SQLite or CSV. Threats and data can be probed harnessing the power and syntax of SQL.
Stars: ✭ 66 (+214.29%)
Mutual labels:  antivirus
Aftermath
A simple anti token-grabber, written in Python.
Stars: ✭ 40 (+90.48%)
Mutual labels:  antivirus
milter-manager
milter manager is a free software to protect you from spam mails and virus mails effectively with milter.
Stars: ✭ 42 (+100%)
Mutual labels:  antivirus
VirusTotalScanner
Scan suspicious applications with over 60 different anti-viruses with a mere two clicks and five seconds!
Stars: ✭ 18 (-14.29%)
Mutual labels:  antivirus
gitavscan
Git Anti-Virus Scan Action - Detect trojans, viruses, malware & other malicious threats.
Stars: ✭ 23 (+9.52%)
Mutual labels:  antivirus

pg_snakeoil - The PostgreSQL Antivirus

Running typical on-access antivirus software on a PostgreSQL server has severe drawbacks such as severely affecting performance or making the filesystem unreliable. The failure modes are extremely problematic when a non-PostgreSQL-aware scanner blocks access to a file due to viruses, or even false-positives and bugs in the scanner software.

We typically recommend not to run such software on PostgreSQL servers, as PostgreSQL knows how to discern between code and data and will not execute any viruses stored in a database. However, running anti-virus software is sometimes required by local policy.

pg_snakeoil provides ClamAV scanning of all data in PostgreSQL in a way that does not interfere with the proper functioning of PostgreSQL and does not cause collateral damage or unnecessary downtimes.

Build Status

Usage

SQL Functions

pg_snakeoil provides SQL functions to scan given data for viruses. The functions can be used manually or automatically, e.g. via triggers or check constraints. The following functions are implemented:

so_is_infected (text) RETURNS bool

Returns true if the given data matches a signature in the virus database.

so_virus_name (text) RETURNS text

Returns virus name if the given data matches a signature in the virus database, empty string otherwise.

so_is_infected (bytea) RETURNS bool

Returns true if the given data matches a signature in the virus database.

so_virus_name (bytea) RETURNS text

Returns virus name if the given data matches a signature in the virus database, NULL otherwise.

so_update_signatures () RETURNS bool

Update signatures, returns true if signatures changed, false otherwise.

Installation

Dependencies

  • libclamav
  • freshclam (recommended to keep signatures current)

Compile

make PG_CONFIG=/path/to/pg_config
sudo make install

Testing

In postgresql.conf, set pg_snakeoil.signature_dir = '/path/to/pg_snakeoil.git/testfiles'.

make installcheck

Preload

pg_snakeoil is loaded by each PostgreSQL backend when needed. An instance of the ClamAV engine is started for every new backend. This takes several seconds for the first function call after connecting.

If backends (connections) do not persist and are only used for a single query, it might be interesting to avoid the overhead for the first function call by adding pg_snakeoil to shared_preload_libraries in postgresql.conf:

shared_preload_libraries = 'pg_snakeoil'

When loaded this way, the ClamAV engine will use the signatures loaded while PostgreSQL was started. Newer signatures will not be loaded automatically. If the extension is not in shared_preload_libraries, new signatures will be used for new connections automatically. The engine can also be reloaded manually with new signatures via SELECT so_update_signatures ();, but this only affects the current backend (connection).

Create Extension

In each database where pg_snakeoil is to be used, execute:

CREATE EXTENSION pg_snakeoil;

Examples

Functions

Ad-hoc checks

postgres=# SELECT so_is_infected('Not a virus!');
 so_is_infected
----------------
 f
(1 row)

postgres=# SELECT so_is_infected('X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*');
 so_is_infected
----------------
 t
(1 row)

postgres=# SELECT so_virus_name('X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*');
    so_virus_name
----------------------
 Eicar-Test-Signature
(1 row)

On Access Check

CREATE EXTENSION pg_snakeoil;
CREATE DOMAIN safe_text AS text CHECK (NOT so_is_infected(value));
CREATE TABLE t1(safe safe_text);


INSERT INTO t1 VALUES ('This text is safe!');
INSERT

INSERT INTO t1 VALUES('X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*');
NOTICE:  Virus found: Eicar-Test-Signature
ERROR:  value for domain safe_text violates check constraint "safe_text_check"

Future Ideas

Scan via pg_recvlogical

pg_recvlogical could be used to acquire the data entering the server instead of file system access, allowing offloading of the CPU-time required for scanning to another server. The reaction to a positive ClamAV result is fully customizable from asynchronous notification of

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].