Skip to content

Instantly share code, notes, and snippets.

View freddyb's full-sized avatar

Frederik B freddyb

View GitHub Profile
@thejh
thejh / bettersystem.c
Last active December 18, 2015 15:25
ULTIMATE VULN FIX
#define _GNU_SOURCE
#include <dlfcn.h>
#include <string.h>
int system(const char *cmd) {
static int (*realsystem)(const char *);
if (!realsystem) realsystem = dlsym(RTLD_NEXT, "system");
if (strchr(cmd, ';') || strchr(cmd, '`') || strstr(cmd, "&&") || strstr(cmd, "../")) {
return 1;
}
@woodrow
woodrow / hpkp_hashes.sh
Created February 21, 2014 07:44
Public key pinning digest generation
# get the SHA-1 digest of the subjectPublicKeyInfo of a certificate as used by Chromium's preloaded public key pinning
# http://src.chromium.org/viewvc/chrome/trunk/src/net/http/transport_security_state_static.h?r1=191212&r2=191211&pathrev=191212
curl -s https://pki.google.com/GIAG2.crt | openssl x509 -inform der -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha1
# (stdin)= 43dad630ee53f8a980ca6efd85f46aa37990e0ea
# get the base64-encoded SHA-256 digest of the subjectPublicKeyInfo of a certificate as used by HTTP Public Key Pinning
# (http://tools.ietf.org/html/draft-ietf-websec-key-pinning-11)
curl -s https://pki.google.com/GIAG2.crt | openssl x509 -inform der -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | base64
# 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y=
@joewalker
joewalker / bootstrap.js
Created June 17, 2012 13:56
Hello Command
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
Components.utils.import("resource:///modules/devtools/gcli.jsm");
var helloCommandSpec = {
name: 'hello',
description: 'Show a message',
params: [
{
@jeffkistler
jeffkistler / control_flow.py
Created October 7, 2011 01:24
Control flow graph building visitor for JavaScript.
"""
An abstract syntax tree visitor for building control flow graphs for ECMAScript
programs and functions.
"""
from bigrig.visitor import NodeVisitor
from bigrig.node import Node
from bigrig import ast
from .graph import Digraph