For versions greater r.125
Each side of your cube consists of two triangles. So the idea is to
process six vertices per iteration in order to create a single
(random) color per side.
https://discourse.threejs.org/t/how-to-color-individual-faces-of-a-boxgeometry-tononindexed-object-using-vertices/30099
const piece = new THREE.BoxGeometry(1, 1, 1).toNonIndexed();
const material = new THREE.MeshBasicMaterial({
vertexColors: true
});
const positionAttribute = piece.getAttribute('position');
const colors = [];
const color = new THREE.Color();
for (let i = 0; i < positionAttribute.count; i += 6) {
color.setHex(0xffffff * Math.random());
colors.push(color.r, color.g, color.b);
colors.push(color.r, color.g, color.b);
colors.push(color.r, color.g, color.b);
colors.push(color.r, color.g, color.b);
colors.push(color.r, color.g, color.b);
colors.push(color.r, color.g, color.b);
} // for
// define the new attribute
piece.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3));
cube = new THREE.Mesh(piece, material);
JSFiddle