V: os.cp is exploitable

Created on 3 Nov 2019  路  3Comments  路  Source: vlang/v

It just uses os.system("cp loc dest");

So, if you use os.cp(". ; <command>", "." ) you could execute any code.

Bug Confirmed

Most helpful comment

Yes, it's a temporary solution until a real os.cp is implemented for non-Windows systems.

I've just banned ; and && in exec/system, so this particular exploit won't work anymore.

All 3 comments

Yes, it's a temporary solution until a real os.cp is implemented for non-Windows systems.

I've just banned ; and && in exec/system, so this particular exploit won't work anymore.

on iOS/macOS there's a syscall to do this

if $darwin {
  copyfile(...)
}

Fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ArcDrake picture ArcDrake  路  3Comments

taojy123 picture taojy123  路  3Comments

penguindark picture penguindark  路  3Comments

radare picture radare  路  3Comments

clpo13 picture clpo13  路  3Comments