We know Ungoliant is Shelob's mother and we know that Shelob lives high up in the mountains surrounding Mordor near Cirith Ungol (note the reference to Ungoliant) and eats whoever comes up there.
So what fate ultimately befell Ungoliant and Shelob?
Science Fiction & Fantasy Stack Exchange is a question and answer site for science fiction and fantasy enthusiasts. It only takes a minute to sign up.Sign up to join this community
Chapter 9 of the Silmarillion ("Of the Flight of the Noldor") suggests that Ungoliant starved to death.
With their whips of flame they smote asunder the webs of Ungoliant, and she quailed, and turned to flight, belching black vapours to cover her; and fleeing from the north she went down into Beleriand, and dwelt beneath Ered Gorgoroth, in that dark valley that was after called Nan Dungortheb, the Valley of Dreadful Death, because of the horror that she bred there. For other foul creatures of spider form had dwelt there since the days of the delving of Angband, and she mated with them, and devoured them; and even after Ungoliant herself departed, and went whither she would into the forgotten south of the world, her offspring abode there and wove their hideous webs. Of the fate of Ungoliant no tale tells. Yet some have said that she ended long ago, when in her uttermost famine she devoured herself at last.
Shelob's fate is unknown but given the extreme nature of her wounds (as seen in Chapter 21 of LORT; "The Choices of Master Samwise"), it's highly likely that she died in her lair:
But Shelob was not as dragons are, no softer spot had she save only her eyes. Knobbed and pitted with corruption was her age-old hide, but ever thickened from within with layer on layer of evil growth. The blade scored it with a dreadful gash, but those hideous folds could not be pierced by any strength of men, not though Elf or Dwarf should forge the steel or the hand of Beren or of Tin wield it. She yielded to the stroke, and then heaved up the great bag of her belly high above Sam's head. Poison frothed and bubbled from the wound. Now splaying her legs she drove her huge bulk down on him again. Too soon. For Sam still stood upon his feet, and dropping his own sword, with both hands he held the elven-blade point upwards, fending off that ghastly roof; and so Shelob, with the driving force of her own cruel will, with strength greater than any warrior's hand, thrust herself upon a bitter spike. Deep, deep it pricked, as Sam was crushed slowly to the ground.
Sam came on. He was reeling like a drunken man, but he came on. And Shelob cowed at last, shrunken in defeat, jerked and quivered as she tried to hasten from him. She reached the hole, and squeezing down, leaving a trail of green-yellow slime, she slipped in, even as Sam hewed a last stroke at her dragging legs. Then he fell to the ground.
Shelob was gone; and whether she lay long in her lair, nursing her malice and her misery, and in slow years of darkness healed herself from within, rebuilding her clustered eyes, until with hunger like death she spun once more her dreadful snares in the glens of the Mountains of Shadow, this tale does not tell.