At sandbox its forbidden
but not at world 1
§7) Sandbox Specific rules
Attacking players without their consent is illegal and always results in a permanent ban. Exception to this is when a player attacks a barbarian village that is conquered before the attack lands or when cross-nobling happens.
Sandbox is a sandbox, meaning settings may change at random for testing purposes.