1. A control device for a work machine, the control device being configured to control a working unit of the work machine to excavate an object to be excavated, the control device comprising: a control unit configured to control the working unit to prevent a working implement of the working unit from crossing a predetermined target profile; and a switching unit configured to define the target profile as an offset profile separated by a predetermined distance from a target excavation profile that is a target profile for finishing of the object to be excavated or the target excavation profile, based on an attitude of the working implement relative to the target excavation profile.