All Projects → psecio → Canary

psecio / Canary

Canary: Input Detection and Response

Projects that are alternatives of or similar to Canary

Golang Tls
Simple Golang HTTPS/TLS Examples
Stars: ✭ 857 (+2855.17%)
Mutual labels:  security-tools, security-hardening
Applicationinspector
A source code analyzer built for surfacing features of interest and other characteristics to answer the question 'What's in the code?' quickly using static analysis with a json based rules engine. Ideal for scanning components before use or detecting feature level changes.
Stars: ✭ 3,873 (+13255.17%)
Mutual labels:  security-tools, detection
Krane
Kubernetes RBAC static Analysis & visualisation tool
Stars: ✭ 254 (+775.86%)
Mutual labels:  security-tools, security-hardening
Ansible Role Hardening
Ansible role to apply a security baseline. Systemd edition.
Stars: ✭ 188 (+548.28%)
Mutual labels:  security-tools, security-hardening
Sentinel Attack
Tools to rapidly deploy a threat hunting capability on Azure Sentinel that leverages Sysmon and MITRE ATT&CK
Stars: ✭ 676 (+2231.03%)
Mutual labels:  security-tools, detection
Privacy.sexy
Open-source tool to enforce privacy & security best-practices on Windows and macOS, because privacy is sexy 🍑🍆
Stars: ✭ 221 (+662.07%)
Mutual labels:  security-tools, security-hardening
Ladongo
Ladon Pentest Scanner framework 全平台LadonGo开源内网渗透扫描器框架,使用它可轻松一键批量探测C段、B段、A段存活主机、高危漏洞检测MS17010、SmbGhost,远程执行SSH/Winrm,密码爆破SMB/SSH/FTP/Mysql/Mssql/Oracle/Winrm/HttpBasic/Redis,端口扫描服务识别PortScan指纹识别/HttpBanner/HttpTitle/TcpBanner/Weblogic/Oxid多网卡主机,端口扫描服务识别PortScan。
Stars: ✭ 366 (+1162.07%)
Mutual labels:  security-tools, detection
Vuls
Agent-less vulnerability scanner for Linux, FreeBSD, Container, WordPress, Programming language libraries, Network devices
Stars: ✭ 8,844 (+30396.55%)
Mutual labels:  security-tools, security-hardening
Awesome Security Hardening
A collection of awesome security hardening guides, tools and other resources
Stars: ✭ 630 (+2072.41%)
Mutual labels:  security-tools, security-hardening
Terraform Aws Secure Baseline
Terraform module to set up your AWS account with the secure baseline configuration based on CIS Amazon Web Services Foundations and AWS Foundational Security Best Practices.
Stars: ✭ 596 (+1955.17%)
Mutual labels:  security-tools, security-hardening
Karn
Simplifying Seccomp enforcement in containerized or non-containerized apps
Stars: ✭ 104 (+258.62%)
Mutual labels:  security-tools, security-hardening
Brutedet
Generalized proof of concept tool which can be used for drop-in bruteforce protection when needed.
Stars: ✭ 5 (-82.76%)
Mutual labels:  security-tools, detection
Vxscan
python3写的综合扫描工具,主要用来存活验证,敏感文件探测(目录扫描/js泄露接口/html注释泄露),WAF/CDN识别,端口扫描,指纹/服务识别,操作系统识别,POC扫描,SQL注入,绕过CDN,查询旁站等功能,主要用来甲方自测或乙方授权测试,请勿用来搞破坏。
Stars: ✭ 1,244 (+4189.66%)
Mutual labels:  security-tools, detection
Electriceye
Continuously monitor your AWS services for configurations that can lead to degradation of confidentiality, integrity or availability. All results will be sent to Security Hub for further aggregation and analysis.
Stars: ✭ 255 (+779.31%)
Mutual labels:  security-tools, security-hardening
Content
Security automation content in SCAP, OSCAL, Bash, Ansible, and other formats
Stars: ✭ 1,219 (+4103.45%)
Mutual labels:  security-tools, security-hardening
Prowler
Prowler is a security tool to perform AWS security best practices assessments, audits, incident response, continuous monitoring, hardening and forensics readiness. It contains more than 200 controls covering CIS, ISO27001, GDPR, HIPAA, SOC2, ENS and other security frameworks.
Stars: ✭ 4,561 (+15627.59%)
Mutual labels:  security-tools, security-hardening
Audit scripts
Scripts to gather system configuration information for offline/remote auditing
Stars: ✭ 55 (+89.66%)
Mutual labels:  security-tools, security-hardening
Lynis
Lynis - Security auditing tool for Linux, macOS, and UNIX-based systems. Assists with compliance testing (HIPAA/ISO27001/PCI DSS) and system hardening. Agentless, and installation optional.
Stars: ✭ 9,137 (+31406.9%)
Mutual labels:  security-tools, security-hardening
Xss Listener
🕷️ XSS Listener is a penetration tool for easy to steal data with various XSS.
Stars: ✭ 414 (+1327.59%)
Mutual labels:  security-tools, security-hardening
Hardening
Hardening Ubuntu. Systemd edition.
Stars: ✭ 705 (+2331.03%)
Mutual labels:  security-tools, security-hardening

Canary: Input Detection and Response

Build Status

The origin of the term "canary" (as a method of detection) was originally used by those that worked deep in mines and would take a canary (the bird) with them to detect gas or other reasons they needed to leave. If the bird started behaving oddly they knew something was amiss. This same concept is applied in the security world and is similarly called a "canary".

Similarly, the Canary library allows you to define key/value combinations that can be used to detect when certain data is used and notify you using a variety of methods including the default PHP error log, log handling via Monolog and messages to Slack channels.

For example, you may generate a special username that you want to use as a trigger. This username isn't actually a user in your system but you do want to be notified if a login attempt is made using it. Canary makes this simple by defining checks with an if method and, optionally, a handler using a then method. For example, say we generated the username of [email protected] and we want to detect when it's used. You can define this in a Canary expression like so:

<?php
$_POST = [
    'username' => '[email protected]',
    'password' => 'sup3rs3cr3t'
];

\Psecio\Canary\Instance::build()->if('username', '[email protected]')->execute();

// Or you can set multiple match values to look for with an array
$matches = [
    'username' => '[email protected]',
    'password' => 'sup3rs3cr3t'
];
\Psecio\Canary\Instance::build()->if($matches)->execute();
?>

In this example we're looking at the current input and checking to see if there's a username value of [email protected]. In the case of our current $_POST values, there's a match. By default (if no then handler is defined) the information about the match is output to the error like (via the Psecio\Canary\Notify\ErrorLog handler). The JSON encoded result looks like this:

{"type":"equals","key":"username","value":"[email protected]"}

NOTE: Canary automatically pulls in the $_GET and $_POST superglobal values for evaluation so you don't need to manually pass then in.

Using an external data source

Canary also allows you to use a (static) class method to provide the if portion of the evaluation with data. To use it, just pass in the class and static method name as a string:

<?php
$classMethod = '\Foo\Bar::criteria';

\Psecio\Canary\Instance::build()->if($classMethod)->execute();
?>

The return from this method must be an array otherwise an exception will be thrown.

Supported Notifier Methods

Currently Canary supports the following notification methods:

Type Class Expected Input
Error log \Psecio\Canary\Notify\ErrorLog None, uses default location
Monolog \Psecio\Canary\Notify\Monolog \Monolog\Logger
Callback \Psecio\Canary\Notify\Callback Callable function
Slack \Psecio\Canary\Notify\Slack \Maknz\Slack\Client
PagerDuty \Psecio\Canary\Notify\PagerDuty \PagerDuty\Event

Creating a Custom Handler (Callback)

If you don't want your results to go to the error log, you can create your own handler via the then method. Currently the only custom handler supported is a callable method. So, say we wanted to output a message to the user of our special username and kill the script. We might use something like this:

<?php
$_POST = ['username' => '[email protected]'];

\Psecio\Canary\Instance::build()->if('username', '[email protected]')
    ->then(function($criteria) {
        die("You shouldn't have done that!");
    })
    ->execute();
?>

In this handler, when it detects that the username value matches our criteria, the callback is executed and the die call kills the script.

Passing in custom data

You can also provide your own data set if you don't want to auto-load the current $_GET and $_POST values. To pass the data in you can use the data value in the configuration and passing it in:

<?php
$config = ['data' => [
    'username' => '[email protected]'
]];
\Psecio\Canary\Instance::build($config)->if('username', '[email protected]')->execute();
?>

Using a default logger

You can set it as the default logger for all if checks via the notify key in the build() configuration options:

<?php

// create a log channel
$log = new Logger('name');
$log->pushHandler(new StreamHandler('/tmp/mylog.log', Logger::WARNING));

$config = [
    'notify' => $log
];
\Psecio\Canary\Instance::build($config)->if('username', '[email protected]')->execute();

?>

NOTE: If you provide a default handler via the notify configuration it will override all other custom notification methods.

Using Monolog

The Canary tool also allows you to use the Monolog logging library to define a bit more customization to the structure of the data and how it's output. Like before, we create the Canary instance but for the input of the then method we provide a Monolog\Logger instance:

<?php
use Monolog\Logger;
use Monolog\Handler\StreamHandler;

require_once 'vendor/autoload.php';

$_GET = ['username' => 'test'];

// create a log channel
$log = new Logger('name');
$log->pushHandler(new StreamHandler('/tmp/mylog.log', Logger::WARNING));

\Psecio\Canary\Instance::build()
    ->if('username', '[email protected]')
    ->then($log)
    ->execute();
?>

Using Slack

You can also make use of the Maknz\Slack library to send messages to Slack when a canary is triggered:

<?php
$settings = [
	'channel' => '#my-channel-name',
	'link_names' => true
];
$slack = new Maknz\Slack\Client('https://hooks.slack.com/services/.....', $settings);

\Psecio\Canary\Instance::build($config)->if('username', '[email protected]')->then($slack);
?>

You'll need to set up an incoming webhook and replace the URL value in the Client create with the custom URL you're given. The default name for the notifications is Canary Agent and the output includes the same JSON information as the other notification methods.

Using PagerDuty

Canary also allows you to send notifications to your account on the PagerDuty service using the nmcquay/pagerduty library:

<?php
$pager = new \PagerDuty\Event();
$pager->setServiceKey('[.... your service ID ....]');

\Psecio\Canary\Instance::build($config)->if('username', '[email protected]')->then($pager);
?>

You can find the service ID by going to your services page (https://[your domain].pagerduty.com/services) and clicking on the service you want to use. The ID is under the "Integrations" tab as the "Integration Key".

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].