I've had 1000 mysterious rattles on basses show up for 1000 different reasons. It's never been a string itself that did it, tho. But here are some causes that I've found...
Active bass' battery in its own compartment, or, under the controls of a typical J or P bass. I use electrical tape and foam around my battery, and a folded card to fill extra space around a battery.
Loose truss rod nut
Loose strap buttons or locks
Loose pickups, pickup screws, pickup springs.
Bridge saddle springs rubbing on the string. Loose bridge saddle screws. Bridge saddle height adjustment screws not being seated on the bridge, as in, one makes contact the other does not. Also, Bridge saddles rubbing, vibrating, under the string, each other.
Bad tuning peg. Loose tuner screws, a tuning key not being tight, Drop D tuner not setup correctly, a lotta things to rattle on tuners, including bushings.
Loose pots or lock washers under knobs. Loose knobs. Loose input jack nut, or interior lock washer.
Loose neck screw/bolt. Loose control cavity screws. Control cavity cover. Battery cover.
String retainers on headstock. Attached badges of any type.
In each of these, and many more, I had to pluck a string at the frequency it caused the rattle, then hurry and grab or otherwise secure the part I believed to be rattling. My most recent puzzle was a HUGE rattle from an old Stingray 5 that myself and anyone near could hear, and swore it was something in the bridge. I tried tons. Finally, in desperation I grabbed the tuning peg furthest from the bridge. The rattle stopped. I was incredulous. We bought a new tuner, the issue disappeared. My own main bass suffers a rattle from the 2 batteries in it's 18v circuit rattling together in the battery compartment. I put tape around the batteries. And fold a card at their ends.
In the end, ya gotta try everything. Cuz it really could, in my experience, be anything...