So I was reading through some stuff and I though to myself, "could there be a square object in space?"
Naturally NO, Once a object is sufficiently large enough (300 km, 511 Davida), given enough time, the gravitational forces will optimize the shape to make it spherical. Most objects are slightly ellipsoid, to balance out its rotation.
There are a few hypothetical objects like a neutron star spinning at a very high speed, causing it be ellipsoid, elongated, almost like an egg.
Artificial/Man-made objects can be square, this would also include stars, planets, and satellites. For a species to achieve this it has to be above Kardashev scale 2.0. You can manipulate electromagnetism to create a thin layer of plasma around an object and force it to conform to that shape, or perhaps use swarms of nanobots made of carbon tubes to create a artificially box, similar to what @Durakken mentioned. But science of any of this artificial structures is beyond the scope of my imagination.
As you know, objects that form primarily due to gravitational collapse tend to be nearly spherical but objects that are shattered / formed due to collision wouldn't be limited by the same processes. With a billion billion ... possible events in a galaxy, it does not seem unreasonable that something square could form.
In the case of a star. We could force it due what qualifies as a star and the materials we have. We just need to create a small star and shove it in a box slightly too small for it which would force it into a cube.
Satellite is easy. Just take a cube of any size and chuck it into orbit. There are probably lots around earth right now... They're just smaller than the size it would take for them to start being spheroidal.
Planets by definition can't be cubes. While I don't agree with the definition of what a planet is currently I do agree with the element that requires spheroidal shape.