This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gcc -o test_kcov test_kcov.c -static | |
#include <fcntl.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/ioctl.h> | |
#include <sys/mman.h> | |
#include <unistd.h> | |
// KCOV IOCTL 定义 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* super fun 2.6.30+/RHEL5 2.6.18 local kernel exploit in /dev/net/tun | |
A vulnerability which, when viewed at the source level, is unexploitable! | |
But which, thanks to gcc optimizations, becomes exploitable :) | |
Also, bypass of mmap_min_addr via SELinux vulnerability! | |
(where having SELinux enabled actually increases your risk against a | |
large class of kernel vulnerabilities) | |
for 2.6.30 without SELinux enabled, compile with: | |
cc -fPIC -fno-stack-protector -shared -o exploit.so exploit.c | |
(on a 64bit system -m64 may be necessary to compile a 64bit .so) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
mv /evilsu /tmp/evilsu | |
chmod u+s /tmp/evilsu | |
chmod 777 /evilsu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$(id -u)" -ne 0 ]; then | |
echo "This script must be run as root. Please use 'sudo' to run it." | |
exit 1 | |
fi | |
if [ $# -eq 0 ]; then | |
echo "Usage: $0 <version>" | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp) | |
{ | |
struct group_info *rqgi; | |
struct group_info *gi; | |
struct cred *new; | |
int i, j; | |
int flags = nfsexp_flags(rqstp, exp); | |
validate_process_creds(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* CGI decoding as C program */ | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdio.h> | |
int hex_values[256]; | |
void init_hex_values() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Location = Tuple[str, int] | |
class Coverage: | |
"""Track coverage within a `with` block. Use as | |
``` | |
with Coverage() as cov: | |
function_to_be_traced() | |
c = cov.coverage() | |
``` | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cgi_decode(s: str) -> str: | |
"""Decode the CGI-encoded string `s`: | |
* replace '+' by ' ' | |
* replace "%xx" by the character with hex number xx. | |
Return the decoded string. Raise `ValueError` for invalid inputs.""" | |
# Mapping of hex digits to their integer values | |
hex_values = { | |
'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, | |
'5': 5, '6': 6, '7': 7, '8': 8, '9': 9, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Decompress a .cpio.gz packed file system | |
rm -rf ./initramfs && mkdir initramfs | |
pushd . && pushd initramfs | |
cp ../initramfs.cpio.gz . | |
gzip -dc initramfs.cpio.gz | cpio -idm &>/dev/null && rm initramfs.cpio.gz | |
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include <fcntl.h> | |
#include <inttypes.h> | |
#include <stdbool.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/io.h> | |
#include <sys/mman.h> |
NewerOlder