1

Hey I wanted to start doing ctf in this website: https://exploit.education/phoenix/

But I have encountered a problem, I can't make the set up work. Here is a link to how to how to set up the ctf - https://blog.lamarranet.com/index.php/exploit-education-phoenix-setup/ I followed the steps until the powershell code: powershell code img

But I keep getting errors from the powershell : Erros

I put the files in D:\Guy - My cp

My shell code -

\Program
     D:\Guy\qemu\qemu-system-x86_64.exe 
    -kernel vmlinuz-4.9.0-8-amd64 
    -initrd initrd.img-4.9.0-8-amd64 
    -append "root=/dev/vda1" 
    -m 1024M `
    -netdev user,id=unet,hostfwd=tcp:127.0.0.1:2222-:22 
    -device virtio-net,netdev=unet 
    -drive file=exploit-education-phoenix-amd64.qcow2,if=virtio,format=qcow2,index=0

my powershell code

If someone can pls help me it will be amazing. Thank you!!!

Santiago Squarzon
  • 41,465
  • 5
  • 14
  • 37

1 Answers1

0

The article unfortunately sets people up for one of the most common pitfalls in powershell, the backtick

`

\Program` Files\qemu\qemu-system-x86_64.exe `
    -kernel vmlinuz-4.9.0-8-amd64 `
    -initrd initrd.img-4.9.0-8-amd64 `
    -append "root=/dev/vda1" `
    -m 1024M `
    -netdev user,id=unet,hostfwd=tcp:127.0.0.1:2222-:22 `
    -device virtio-net,netdev=unet `
    -drive file=exploit-education-phoenix-amd64.qcow2,if=virtio,format=qcow2,index=0

They are used to escape the space in Program Files and the newline character at the end of each line. Copying and pasting from a website can cause issues easily such as adding a space after them, breaking the line continuation. I'd recommend using splatting as it's just as or easier to read and not as error prone.

$params = @{
    kernel = 'vmlinuz-4.9.0-8-amd64'
    initrd = 'initrd.img-4.9.0-8-amd64'
    append = "root=/dev/vda1"
    m      = '1024M'
    netdev = 'user,id=unet,hostfwd=tcp:127.0.0.1:2222-:22'
    device = 'virtio-net,netdev=unet'
    drive  = 'file=exploit-education-phoenix-amd64.qcow2,if=virtio,format=qcow2,index=0'
}

& '\Program Files\qemu\qemu-system-x86_64.exe' @params

Also used the call operator & and quoted the executable path since it contains a space.

Doug Maurer
  • 8,090
  • 3
  • 12
  • 13
  • I tried it: $params = @{ kernel = 'vmlinuz-4.9.0-8-amd64' initrd = 'initrd.img-4.9.0-8-amd64' append = "root=/dev/vda1" m = '1024M' netdev = 'user','id=unet','hostfwd=tcp:127.0.0.1:2222-:22' device = 'virtio-net','netdev=unet' drive = 'file=exploit-education-phoenix-amd64.qcow2','if=virtio','format=qcow2','index=0' } & '\D:\Guy\qemu\qemu-system-x86_64.exe' @params and it does not give an error but it still does not work (maybe i am wrong with the file_path) – GUY Yankovitch Jul 17 '21 at 20:52