Skip to content

Instantly share code, notes, and snippets.

View drewmnoel's full-sized avatar
✴️

Drew Noel drewmnoel

✴️
View GitHub Profile
@drewmnoel
drewmnoel / FormsAuthenticationTicketHelper.cs
Created December 8, 2021 20:31 — forked from dazinator/FormsAuthenticationTicketHelper.cs
Decrypt a Legacy ASP.NET Forms Authentication Cookie (that uses SHA1 validation, and AES encryption) - without horrendous dependencies on system.web.. This allows you to decrypt a forms authentication cookie that was created in ASP.NET 3.5, from an ASP.NET 5 application.
internal static class FormsAuthenticationTicketHelper
{
private const byte CURRENT_TICKET_SERIALIZED_VERSION = 0x01;
private const int MAX_TICKET_LENGTH = 4096;
// Resurrects a FormsAuthenticationTicket from its serialized blob representation.
// The input blob must be unsigned and unencrypted. This function returns null if
// the serialized ticket format is invalid. The caller must also verify that the
// ticket is still valid, as this method doesn't check expiration.
#!/bin/bash
# Vuln via: scp /etc/passwd temp@localhost:'`touch /tmp/exploit2.sh`/targetfile'
set -f
set -- $SSH_ORIGINAL_COMMAND
# This replicates a really bad filter
case "$1" in
'ssh*')
>&2 echo "Access denied"