A domain name is an asset.
Simply being dead is never going to invalidate a domain name registration. Provided contact can be made with the executor of the will, it's hard to see that any rules being broken. However, registering a domain in the name of someone who is already dead would not be allowed.
If a company goes bankrupt, the liquidator/administrator may choose to dispose of the domain name by any means he/she chooses, including letting it expire.
If you want to buy the domain name, your only option is the usual channels.