Heat the oil: add the garlic and shallots and fry briefly, remove from the oil and set aside. Add the chilies and fry until they start to change color, then remove them and set them aside.
In a mortar and pestle pound the shrimp paste, add the chiles, garlic and shallots, blending each in before adding the next. Then over low heat return all the ingredients to the oil, and fold into a uniform paste.
The resulting thick, slightly oily red/black sauce will keep almost
indefinitely. If you wish you can add more fish sauce and/or sugar to get the flavor you want.