Skip to content

Instantly share code, notes, and snippets.

@wcypierre
wcypierre / gist:5994996
Created July 14, 2013 17:19
[C/C++] Delete/Free exploitation
http://web.archive.org/web/20080703153358/http://taossa.com/index.php/2007/01/03/attacking-delete-and-delete-in-c
#!/usr/bin/php
<?php
// http://w3.tbd.my/thread-14121-post-163114.html#pid163114
//$key = "3"; // 3 = 51, "=" = 61
//echo "Original Algo: \n";
//var_dump(algo2($key));
@wcypierre
wcypierre / gist:6095072
Last active December 20, 2015 07:39
Copy binary with dependencies into a folder
cp /bin/sh /var/chroot/sshd/bin/;\
ldd /bin/sh|awk '{print $3}'|grep -e '^/'|xargs -I{} cp -v --parent '{}' /var/chroot/sshd/
Credits to: http://blog.jandorsman.com/2011/10/copying-a-binary-and-its-shared-libraries-to-a-chrooted-directory/
@wcypierre
wcypierre / ssh_chroot.txt
Created July 27, 2013 18:41
[HOWTO] SSH Chroot
http://www.debian.org/doc/manuals/securing-debian-howto/ap-chroot-ssh-env.en.html
http://stephan.paukner.cc/syslog/archives/332-SSH-daemon-in-a-chroot-on-Debian-lenny.html
http://www.gelato.unsw.edu.au/IA64wiki/DebianSSHChroot
@wcypierre
wcypierre / bin_lib_copy.sh
Created July 27, 2013 18:45
[Script] Copy Binary and dependencies(libraries) to a folder
#!/bin/bash
cp `which $1` /var/chroot/sshd/bin/;\
ldd `which $1`|awk '{print $3}'|grep -e '^/'|xargs -I{} cp -v --parent '{}' /var/chroot/sshd/
@wcypierre
wcypierre / .bashrc chroot fix
Last active December 20, 2015 08:09
[Chroot] .bashrc does not work
As the shell created when you chroot is a login shell, so .bashrc does not works.
Hence, cp the .bashrc to .bash_profile and it will work. Keep the .bashrc as well in the case that you need to spawn another bash instance
http://stackoverflow.com/questions/13570558/user-environment-is-not-sourced-with-chroot
@wcypierre
wcypierre / gist:6129784
Created August 1, 2013 09:15
[Debian7]Warning: Falling back to the standard locale ("C")
Type:
dpkg-reconfigure locales
scroll up/down by using up/down arrow and press space to select the locale and install it and its done
@wcypierre
wcypierre / debian_setup.sh
Last active December 20, 2015 13:09
[Debian 7] Chroot Setup
#!/bin/bash
# Made for Debian 7 with CLI
apt-get remove --purge apache2 xinetd samba bind bind9 -y;
apt-get update -y;
service apache2 stop;
rm /etc/init.d/apache2;
sleep 2;
apt-get install dialog -y;
dpkg-reconfigure locales;
apt-get install g++-4.7 g++-4.6 g++-4.4 g++ gcc clang -y;
@wcypierre
wcypierre / ssh-chroot
Created August 2, 2013 08:20
[Debian7] ssh-chroot
#! /bin/sh
### BEGIN INIT INFO
# Provides: sshd
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: OpenBSD Secure Shell server
### END INIT INFO
@wcypierre
wcypierre / 50limits.conf
Created August 2, 2013 19:24
[Debian 7] GateOne 1.2 50limits.conf
// This is an example of a limits.conf file. You'll need to create your own.
// The limits.conf file controls "how much" of any given feature or function a
// given user or group may utilize. The format of this file is JSON with
// support for JavaScript-style comments (they will be removed before parsing).
{
// "*" for default (all users)
"*": {
"terminal": { // This is the "application" i.e. whatever is passed to @require(policies("<applicati$
"max_terms": 50 // An absolute maximum
}