Short answer is no, long answer is depends.
Short answer: no, that's not how systems works. You need authorization to run commands on systems, and if you don't have authorization, you cannot run anything on them.
Long answer: depends on several issues, is a catastrophic failure, it's extremely rare to find one "in the wild," and it usually leads to total compromise and potential destruction of the system (or systems) affected.
If the system is part of a Windows Domain, you can send them commands to run if you are part of the domain, and you have proper privileges on the domain. There are some commands (like psexec
) that allows you to send commands to any connected system on the domain.
If the system have vulnerable applications running, you could send a specially crafted packet to the port used by the application, trigger an error and execute code when it should not.
Other applications parse user input and execute procedures based on the input, and could be tricked into executing code instead.
Remote code execution pathways are a high priority issue on any organization and they are addressed very fast. Applications with remote code execution are usually taken offline or firewalled from external access until fixed. User logins that are compromised are locked out.
Usually a system that is vulnerable to a unauthenticated remote code execution over network will get infected with either ransomware, crypto mining software, or both.