When hdiutil attach hangs rather than errors, it's usually one of two things.
First, a previous mount attempt left a stuck handle. Run `hdiutil info` in Terminal — if you see anything referencing that STM32 DMG (or any other image that shouldn't be there), detach it with `hdiutil detach /dev/diskN` and try again.
Second, Gatekeeper does an online notarization check on third-party installers and it can hang on a slow or filtered network. Try `hdiutil attach -nobrowse -readonly -noverify /Users/aryan/Downloads/st-stm32cubeide_2.1.0_27993_20260219_1630_aarch64.dmg` — noverify skips the checksum step and nobrowse keeps Finder from involving Quick Look.
If it still hangs, in a second Terminal window run `log stream --predicate 'process == "diskimages-helper"'` while you kick off the attach. That'll tell you what it's actually blocked on.