🚩
CTF Writeups
  • CTF Writeups
  • CloudSEK 2023 Writeups
    • Bases
    • Serialization Saga
    • The SHA Juggler
  • Cyber Heroines CTF 2023 Writeups
    • crypto
      • Lenore Blum
      • Sophie Wilson
    • forensics
      • Barbara Liskov
      • Elizabeth Feinler
      • Margaret Hamilton
      • Marian Croak
      • Stephanie Wehner
    • pwn
      • Sally Ride
    • re
      • Anita Borg
    • web
      • Frances Allen
      • Grace Hopper
      • Radia Perlman
      • Shafrira Goldwasser
      • Susan Landau
  • DeconstruCTF 2023 Writeups
    • Gibberish
    • Hash Roll
    • MOVE
    • Magicplay
    • Missing
    • Snowy Rock
    • Space Ahoy
    • Two Paths
    • Very Basic
    • gitcha
    • sweet-nothing
    • where-are-the-cookies
    • why-are-types-weird
  • Digital Defenders CTF 2023
  • ISFCR EC CTF 2023 Writeups
    • Base the Bases
    • CrackMe
    • Device
    • Emoji Man
    • Fast Fernet
    • Hands Up
    • Hot and Cold
    • I walk alone
    • Inception
    • Lucky Guess?
    • Mess
      • chal
    • NotFooter
    • Oink Oink v2
    • Oink Oink v0
    • Oink Oink v1
    • STR
    • Seek The Treasure
    • Standard-bearer
    • Tap The Wire
    • Thomas The Train
    • What You See Is (Not) What You Get
    • Where's My Dog?
    • splitXquest
    • Zip Bomb
  • KICyber CTF 2023 Writeups
    • All Hail Hydra
    • Binary Cryptogram - Unravel the Enigma
    • Breakout - Unleash the Flag
    • Cross Platform Hunt
    • CryptoShift - Decipher the Hidden Message
    • Hidden-Network-Quest
    • MetaQuest
    • No remorse, No regret
    • OTP Portal Intrigue
    • Policy-patrol_IAM
    • Secure-Storage-Showdown
    • The-Forbidden-Telnet-Portal
    • Time Traveler's Git (Part 1)
    • Time Traveler_s Git (Part 2)
    • Time-Capsule
    • Unveiling the Hidden Message
    • Welcome to KICyber CTF
    • XORCrypt: Solitary Cipher
    • Zipper is stuck
  • Snyk Fetch The Flag 2023 Writeups
    • Back The Hawks
    • Beep64
    • Finders Keepers
    • Jott
    • Nine-One-Sixteen
    • Protecting Camp
    • Quick Maths
    • Unhackable Andy II
    • Unhackable Andy
  • YCTF Mini 2023 Writeups
    • Cat's Concert 🎧🎵
    • Death Song
    • Enigmatic Vault
    • Fire Accident
    • Military Spy
    • Movie scene
    • OSINT 1
    • OSINT 2
    • Stego Master
    • Twinkle Twinkle
    • Unchained 1
    • Unchained 2
    • Inception
  • flaws.cloud
  • YCTF-Weekly 2023
    • Week-2
      • Web
        • Cookie
        • Confluence
      • Misc
        • Never Found
Powered by GitBook
On this page
  • Solution
  • FLAG
  1. CloudSEK 2023 Writeups

Bases

Last updated 1 year ago

Do you Know Your Bases?

nc 43.204.152.119 1337

Solution

  • On using netcat to connect to the IP and port, we are given a base64 encoded string. For which we have to decode it and give as an answer.

  • Upon giving the correct decoded string, we get another encoded string which we have to decode and on giving a wrong answer, the connection closes

  • We can use the pwntools library in python to solve this.

  • Using the below we get the flag

# Importing required modules
from pwn import *
import base64

# Connecting to the remote target
io = remote('43.204.152.119', 1337)

# Function to decode the base64 string
def decode_base64(data):
    return base64.b64decode(data)

# Loop to receive and decode the base64 string, until the flag is obtained
while True:
		# Receiving data fromm server and printing out only the base64 string
    received_data = io.recvline().decode().strip()
    print("Received:", received_data)
		
		# Checking if the data contains the flag in the specific format
    if "CSEK{" in received_data:
        print("Flag:", received_data)
        break
    
		# Extract base64 encoded string 
    encoded_data = received_data.split(":")[1].strip()
		
		# Decode the base64 data
    decoded_data = decode_base64(encoded_data)

		# Send the decoded data back to the server
    io.sendline(decoded_data)
    print("Sending:", decoded_data)

io.close()
  • After running the script for a few seconds we get the flag

FLAG

CSEK{3he_bas3_dec04er}
script.py
flag