In marine transportation, many ships are equipped with AIS devices. The AIS data sent by AIS devices can help the maritime authorities and other ships obtain the navigation condition of the ship, thereby ensuring the safety of ships during navigation. However, when a ship is involved in illegal activities, the crew may close the AIS device or tamper with Maritime Mobile Service Identity (MMSI) in the AIS data. To detect these two kinds of behaviors, this paper designs the AIS closing detection algorithm and MMSI spoofing detection algorithm based on the spatiotemporal data provided by AIS and radar. As the radar data does not include the ship’s identification, the associated relationship between radar data and AIS data is difficult to determine in the multi-ship scenario. To solve this problem, the D-TRAP is defined in this paper, it is applied in the process of searching for the associated AIS points of radar trajectory points, when the number of effective AIS points is reduced caused by the above two behaviors, the association method used in the paper has better performance. In addition, real data and simulation data are used to verify the two algorithms. The verification results show that when the ship is simultaneously monitored by radar and AIS, and the monitoring process continues for a period of time, the AIS closing detection algorithm has good performance. When the ship is monitored by AIS and radar before and after MMSI spoofing, and both monitoring processes continue for a period of time, the MMSI spoofing algorithm has good performance.