In Vedic Astrology there are nine planets and according to their nature they are known as benefic (good) and malefic (not good) planets. Rahu (North Node) and Ketu (South Node) are always considered malefics planets for everyone, but these are the points which helps in your soul growth after giving mental suffering.
Benefic (good) planets are: Waxing Moon, Venus, and Jupiter. These planets are considered mild and benefics in general.
Malefics (not good) planets are: Waning Moon, Mars, Saturn and Sun. These planets are considered cruel in nature and malefics in general.
But this is not the truth. The planets benefic or malefic is depending on the house rulerships of the planets according to your ascendant.
Every planet rules different houses according to the ascendant and on the basis of that planets considered benefics and malefics.
In vedic astrology there are some houses which are considered malefic and these houses are 6th, 8th and 12th houses. Depending on your ascendant these house rules by different planets and these planets considered malefic for that particular ascendant. These planets are known as functional malefics because they give results of malefics houses.
Every planet rules two signs in Vedic astrology and has its mooltrikona signs; it means the sign is stronger in nature.
PLANET LORD MOOLTRIKONA SIGN
Sun Leo Leo (0-20 degrees)
Moon Cancer Taurus (4 - 20 degrees)
Mars Aries, Scorpio Aries (0-12 degrees)
Mercury Virgo, Gemini Virgo (16-20 degrees)
Jupiter Sagittarius, Pisces Sagittarius (0-10 degrees)
Venus Taurus, Libra Libra (0-17 degrees)
Saturn Capricorn, Aquarius Aquarius (0-20 degrees)
So if these planet's mooltrikona sign falls in 6th, 8th, and 12th house that planet is considered malefic.
So let's see what are functional malefics planets for each ascendants:
Aries: Mercury (mooltrikona sign Virgo falls in 6th house). Rahu and Ketu.
Taurus: Venus (mooltrikona sign Libra falls in 6th house), Jupiter (mooltrikona sign Sagittarius falls in 8th house), Mars (mooltrikona sign Aries falls in 12th house), Rahu and Ketu.
Gemini: No mooltrikona signs fall in 6th, 8th and 12th house. So no functional malefics planets for Gemini ascendant.
Cancer: Jupiter (mooltrikona sign Sagittarius falls in 6th house), Saturn (mooltrikona sign aquarius falls in 8th house).
Leo: No mooltrikona signs fall in 6th, 8th and 12th house. So no functional malefics planets for Leo ascendant, but Moon considered malefic because it rules the 12th house.
Virgo: Saturn, (mooltrikona sign Aquarius falls in 6th house), Mars (mooltrikona sign Aries falls in 6th house), Sun, (mooltrikona sign Leo falls in 12th house).
Libra: Mercury (mooltrikona sign Virgo falls in 12th house).
Scorpio: Mars (mooltrikona sign Aries falls in 6th house), Venus (mooltrikona sign Libra falls in 12th house).
Sagittarius: The Moon (mooltrikona sign Taurus falls in 6th house). Rahu and Ketu.
Capricorn: The Sun (mooltrikona sign Leo falls in 8th house), Jupiter (mooltrikona sign Sagittarius falls in 12th house).
Aquarius: The Moon considered malefic as it ruled 6th house, Mercury (mooltrikona sign Virgo falls in 8th house).
Pisces: The Sun (mooltrikona sign Leo falls in 6th house), Venus (mooltrikona sign Libra falls in 8th house), Saturn (mooltrikona sign Aquarius falls in 12th house).
Rahu and Ketu malefics for every ascendant.
So whenever these planets mahadasha run, the person suffers through some difficulty in life according to their house rulership.