Shared folders like /tmp are a classic place for attacks: one user creates a file with a predictable name, and a program run by another user, often root, opens and writes to it. The kernel has switches that block this pattern.
sysctl fs.protected_regular fs.protected_fifos fs.protected_symlinks fs.protected_hardlinks
The kernel documentation describes protected_regular like this: with 1, a program may not open a regular file with O_CREAT in a world writable sticky folder when someone else owns that file, unless that person also owns the folder. With 2 the same rule covers group writable sticky folders too. protected_fifos does the same for named pipes. The symlink and hardlink switches block the older trick of planting links in those folders.
Most current distributions turn all four on through systemd’s defaults. I would still check them on an older server, a minimal image or a custom kernel:
echo 'fs.protected_regular = 2' | sudo tee /etc/sysctl.d/90-protected.conf
sudo sysctl -p /etc/sysctl.d/90-protected.conf
This can break badly written scripts. A root cron job that writes to /tmp/report.txt, a file first created by another user, now fails with Permission denied. That failure is exactly the risky pattern being blocked. The better fix is in the script: create temp files with mktemp, so the name is unpredictable and the file is new and yours.
Further reading: Documentation for /proc/sys/fs/