An intracellular compartment in a host cell which increases the efficiency of viral replication and/or assembly, and shields the virus from host defenses. Viral factories can be either cytoplasmic or nuclear and often arise from extensive rearrangement of host cell cytoskeletal and/or cell membrane compartments. (Gene Ontology, GO_0039713)