Measure the voltage between ECM connector and chassis ground.
Does the voltage change by shaking the harness and connector of ECM while monitoring the value with Subaru Select Monitor?
Repair the poor contact of ECM connector.