The below information was pulled directly from https://law.lis.virginia.gov/vacode/title54.1/chapter21/section54.1-2132/ I'll simply be sharing the law below without elaboration.
More details on the legality of buyer brokerage agreements
Beginning of quoted text from VA legal code on 2/5/23, excepting section G where quotes will be used when quoting the law or otherwise:
§ 54.1-2132. Licensees engaged by buyers.
A. A licensee engaged by a buyer shall:
Perform in accordance with the terms of the brokerage agreement
2. Promote the interests of the buyer by:
a. Seeking a property of a type acceptable to the buyer and at a price and on terms acceptable to the buyer; however, the licensee shall not be obligated to seek other properties for the buyer while the buyer is a party to a contract to purchase property unless agreed to as part of the brokerage relationship;
b. Assisting in the drafting and negotiating of offers and counteroffers, amendments, and addenda to the real estate contract pursuant to § 54.1-2101.1 and in establishing strategies for accomplishing the buyer's objectives;
c. Receiving and presenting in a timely manner all written offers or counteroffers to and from the buyer and seller, even when the buyer is already a party to a contract to purchase property; and
d. Providing reasonable assistance to the buyer to satisfy the buyer's contract obligations and to facilitate settlement of the purchase contract;
3. Maintain confidentiality
Maintain confidentiality of all personal and financial information received from the client during the brokerage relationship and any other information that the client requests during the brokerage relationship be maintained confidential unless otherwise provided by law or the buyer consents in writing to the release of such information;
4. Exercise ordinary care;
5. Account in a timely manner for all money and property received by the licensee in which the buyer has or may have an interest;
6. Disclose to the buyer material facts related to the property or concerning the transaction of which the licensee has actual knowledge; and
B. Licensees shall treat all prospective sellers honestly and shall not knowingly give them false information.
If a licensee has actual knowledge of the existence of defective drywall in a residential property, the licensee shall disclose the same to the buyer. For purposes of this section, "defective drywall" means all defective drywall as defined in § 36-156.1. No cause of action shall arise against any licensee for revealing information as required by this article or applicable law. In the case of a residential transaction, a licensee engaged by a buyer shall disclose to a seller whether or not the buyer intends to occupy the property as a principal residence. The buyer's expressions of such intent in the contract of sale shall satisfy this requirement and no cause of action shall arise against any licensee for the disclosure or any inaccuracy in such disclosure, or the nondisclosure of the buyer in this regard.
C. A licensee engaged by a buyer in a real estate transaction may, unless prohibited by law or the brokerage agreement, provide assistance to the seller, or prospective seller, by performing ministerial acts.
Performing such ministerial acts that are not inconsistent with subsection A shall not be construed to violate the licensee's brokerage agreement with the buyer unless expressly prohibited by the terms of the brokerage agreement, nor shall performing such ministerial acts be construed to form a brokerage relationship with such seller.
D. A licensee engaged by a buyer does not breach any duty or obligation to the buyer by showing properties in which the buyer is interested to other prospective buyers, whether as clients or customers, by representing other buyers looking at the same or other properties, or by representing sellers relative to other properties.
E. Licensees in residential real estate transactions shall disclose brokerage relationships pursuant to the provisions of this article.
F. Nothing in this section shall be construed to require a licensee to disclose whether settlement services under Chapter 10 (§ 55.1-1000 et seq.) of Title 55.1 will be provided by an attorney or a nonattorney settlement agent.
G. Buyer brokerage agreement requirements before showings
This part can get confusing since there's no reference to where the details are elsewhere in the law, so I've added it below.
"G. Notwithstanding any other provision of law requiring written brokerage agreements or governing the duties of licensees, nothing in this chapter shall be construed to require that a written agreement between a licensee and a prospective buyer be executed prior to the licensee's showing properties to the prospective buyer."
The additional details on that are found in another section of the law. As laid out in VA codes54.1-2130 &54.1-2137, further detailed in this document from townhall.virginia.gov titled, "Guidance Document on necessity for brokerage agreement", "Is the party looking for the licensee to provide advice and counsel requiring the licensee to exercise his judgment or discretion for the purpose of procuring a seller... ready, able, and willing to sell...real estate? If so, this would require a written brokerage agreement."
The document further states, "showing a house may be ministerial if the licensee takes the party to see what the typical features are in homes in the market area or to gather information on the market or area. However, if the party asks the licensee to show him real estate because his intent is to have the licensee procure someone who is ready, able and willing to sell... real estate then a brokerage relationship exists requiring a written brokerage agreement."