A work machine comprising: a machine body; a work device attached to the machine body; a plurality of hydraulic actuators (204a, 205a, 206a) that drive the machine body or the work device; a hydraulic pump (1 - 3); a plurality of directional control valves (7 - 11, 14, 15) that are connected in parallel to a delivery line of the hydraulic pump (1 - 3), and adjust a flow of a hydraulic fluid supplied from the hydraulic pump (1 - 3) to the plurality of hydraulic actuators (204a, 205a, 206a); an operation lever (17a, 17b) for giving an instruction to operate the plurality of hydraulic actuators (204a, 205a, 206a); a controller that executes a machine control function that prevents the work device from going into a preset area, and auxiliary flow rate control devices (24 - 30) that are arranged upstream of the plurality of directional control valves (7 - 11, 14, 15), and limit the flow rate of the hydraulic fluid supplied from the hydraulic pump (1 - 3) to the plurality of directional control valves (7 - 11, 14, 15) in accordance with pressure variations at the plurality of hydraulic actuators (204a, 205a, 206a), wherein the controller is configured to cause the auxiliary flow rate control devices (24 - 30) to limit the flow rate of the hydraulic fluid supplied to the plurality of directional control valves (7 - 11, 14, 15), characterized in that the work machine comprises a machine control switch for giving an instruction to activate or deactivate the machine control function, and the controller is configured to, in a case where the machine control function is cancelled via the machine control switch, cancel limitation of the flow rate of the hydraulic fluid supplied to the plurality of directional control valves (7 - 11, 14, 15), the limitation being performed by the auxiliary flow rate control devices (24 - 30), and in a case where the machine control function is selected via the machine control switch, cause the auxiliary flow rate control devices (24 - 30) to limit the flow rate of the hydraulic fluid supplied to the plurality of directional control valves (7 - 11, 14, 15), thereby executing the machine control function. a machine body; a work device attached to the machine body; a plurality of hydraulic actuators (204a, 205a, 206a) that drive the machine body or the work device; a hydraulic pump (1 - 3); a plurality of directional control valves (7 - 11, 14, 15) that are connected in parallel to a delivery line of the hydraulic pump (1 - 3), and adjust a flow of a hydraulic fluid supplied from the hydraulic pump (1 - 3) to the plurality of hydraulic actuators (204a, 205a, 206a); an operation lever (17a, 17b) for giving an instruction to operate the plurality of hydraulic actuators (204a, 205a, 206a); a controller that executes a machine control function that prevents the work device from going into a preset area, and auxiliary flow rate control devices (24 - 30) that are arranged upstream of the plurality of directional control valves (7 - 11, 14, 15), and limit the flow rate of the hydraulic fluid supplied from the hydraulic pump (1 - 3) to the plurality of directional control valves (7 - 11, 14, 15) in accordance with pressure variations at the plurality of hydraulic actuators (204a, 205a, 206a), wherein the controller is configured to cause the auxiliary flow rate control devices (24 - 30) to limit the flow rate of the hydraulic fluid supplied to the plurality of directional control valves (7 - 11, 14, 15), characterized in that the work machine comprises a machine control switch for giving an instruction to activate or deactivate the machine control function, and the controller is configured to, in a case where the machine control function is cancelled via the machine control switch, cancel limitation of the flow rate of the hydraulic fluid supplied to the plurality of directional control valves (7 - 11, 14, 15), the limitation being performed by the auxiliary flow rate control devices (24 - 30), and in a case where the machine control function is selected via the machine control switch, cause the auxiliary flow rate control devices (24 - 30) to limit the flow rate of the hydraulic fluid supplied to the plurality of directional control valves (7 - 11, 14, 15), thereby executing the machine control function.