<PAGE>

                                                                    Exhibit 10.4

                            INDEMNIFICATION AGREEMENT

      This Agreement is made as of the 26th day of September 2002, by and
between Netegrity, Inc., a Delaware corporation (the "Corporation), and Lawrence
D. Lenihan, Jr. (the "Indemnitee"), a director of the Corporation.

      WHEREAS, it is essential to the Corporation to retain and attract as
directors the most capable persons available, and

      WHEREAS, the substantial increase in corporate litigation subjects
directors to expensive litigation risks at the same time that the availability
of directors' and officers' liability insurance has been severely limited, and

      WHEREAS, it is now and has always been the express policy of the
Corporation to indemnify its directors, and

      WHEREAS, the Indemnitee does not regard the protection available under the
Corporation's Certificate of Incorporation, By-laws and insurance as adequate in
the present circumstances, and may not be willing to serve or continue to serve
as a director without adequate protection, and

      WHEREAS, the Corporation desires the Indemnitee to serve, or continue to
serve, as a director of the Corporation.

      NOW THEREFORE, the Corporation and the Indemnitee do hereby agree as
follows:

      1. Agreement to Serve. The Indemnitee agrees to serve or continue to serve
as a director of the Corporation for so long as the Indemnitee is duly elected
or until such time as the Indemnitee tenders a resignation in writing.

      2. Third Party Actions. The Corporation shall indemnify the Indemnitee if
the Indemnitee was or is a party or is threatened to be made a party to any
threatened, pending or completed action, suit or proceeding, whether civil,
criminal, administrative or investigative (each, a "Proceeding") (other than an
action by or in the right of the Corporation) by reason of the fact that he is
or was a director, officer, employee or agent of the Corporation, or is or was
serving at the request of the Corporation as a director, officer, employee or
agent of another corporation, partnership, joint venture, trust or other
enterprise against expenses (including attorney's fees), judgments, fines and
amounts paid in settlement actually and reasonably incurred by the Indemnitee in
connection with such Proceeding.

      3. Derivative Actions. The Corporation shall indemnify the Indemnitee if
the Indemnitee was or is a party or is threatened to be made a party to any
Proceeding by or in the right of the Corporation to procure a judgment in its
favor by reason of the fact that the Indemnitee is or was a director, officer,
employee or agent of the Corporation, or is or was serving at the request of the
Corporation as a director, officer, employee or agent of another corporation,
partnership, joint venture, trust or other enterprise against expenses
(including attorneys' fees) actually and reasonably incurred by the Indemnitee
in connection with the defense or settlement of such Proceeding.
<PAGE>
      4. Expenses. To the extent that the Indemnitee has been successful on the
merits or otherwise in defense of any Proceeding referred to in Sections 2 and
3, or in defense of any claim, issue or matter therein, the Indemnitee shall be
indemnified against expenses (including attorneys' fees) actually and reasonably
incurred by the Indemnitee in connection therewith.

      5. Authorization and Request for Indemnification.

            (a) Any indemnification requested by the Indemnitee under Section 2
hereof shall be made no later than ten (10) days after receipt of the written
request of the Indemnitee, unless it shall have been adjudicated by a court of
final determination that the Indemnitee did not act in good faith and in a
manner he reasonably believed to be in, or not opposed to, the best interests of
the Corporation, and with respect to any criminal action or proceeding, had no
reasonable cause to believe his conduct was unlawful.

            (b) Any indemnification requested by the Indemnitee under Section 3
hereof shall be made no later than ten (10) days after receipt of the written
request of the Indemnitee, unless it shall have been adjudicated by a court of
final determination that the Indemnitee did not act in good faith and in a
manner the Indemnitee reasonably believed to be in, or not opposed to, the best
interests of the Corporation, the Indemnitee shall have been finally adjudged to
be liable to the Company by a court of competent jurisdiction due to willful
misconduct of a culpable nature in the performance of the Indemnitee's duty to
the Corporation unless and only to the extent that any court in which such
Proceeding was brought shall determine upon application that despite the
adjudication of liability, but in view of all the circumstances of the case,
such person is fairly and reasonably entitled to indemnity for such expenses as
such court shall deem proper.

      6. Advance Payment of Expenses. Subject to Section 5 above, the
Corporation shall advance all expenses incurred by the Indemnitee in connection
with the investigation, defense, settlement or appeal of any Proceeding to which
the Indemnitee is a party or is threatened to be made a party by reason of the
fact that the Indemnitee is or was an agent of the Corporation. The Indemnitee
hereby undertakes to repay such amounts advanced only if, and to the extent
that, it shall ultimately be determined that the Indemnitee is not entitled to
be indemnified by the Corporation. The advances to be made hereunder shall be
paid by the Corporation to or on behalf of the Indemnitee within 30 days
following delivery of a written request therefor by the Indemnitee to the
Corporation.

      7. Remedies. The right to indemnification or advancement of expenses as
provided by this Agreement shall be enforceable by the Indemnitee in any court
of competent jurisdiction. Unless otherwise required by law, the burden of
proving that indemnification is not appropriate shall be on the Corporation. The
Indemnitee's expenses reasonably incurred in connection with successfully
establishing the Indemnitee's right to indemnification, in whole or in part, in
any such Proceeding shall also be indemnified by the Corporation.

      8. Partial Indemnification. If the Indemnitee is entitled under any
provision of this Agreement to indemnification by the Corporation for some or a
portion of the expenses, judgments, fines, penalties or amounts paid in
settlement actually and reasonably incurred by or on behalf of the Indemnitee in
connection with any Proceeding but not, however, for the total amount thereof,
the Corporation shall nevertheless indemnify the Indemnitee for the portion of
<PAGE>
such expenses, judgments, fines, penalties or amounts paid in settlement to
which the Indemnitee is entitled.

      9. Subrogation. In the event of any payment under this Agreement, the
Corporation shall be subrogated to the extent of such payment to all of the
rights of recovery of the Indemnitee, who shall execute all papers required and
take all action necessary to secure such rights, including execution of such
documents as are necessary to enable the Corporation to bring suit to enforce
such rights.

      10. Term of Agreement. This Agreement shall continue until and terminate
upon the later of (a) six years after the date that the Indemnitee shall have
ceased to serve as a director or officer of the Corporation or, at the request
of the Corporation, as a director, officer, partner, trustee, member, employee
or agent of another corporation, partnership, joint venture, trust, limited
liability company or other enterprise or (b) the final termination of all
Proceedings pending on the date set forth in clause (a) in respect of which the
Indemnitee is granted rights of indemnification or advancement of expenses
hereunder and of any proceeding commenced by the Indemnitee pursuant to
Paragraph 7 of this Agreement relating thereto.

      11. Indemnification Hereunder Not Exclusive. The indemnification and
advancement of expenses provided by this Agreement shall not be deemed exclusive
of any other rights to which the Indemnitee may be entitled under the
Certification of Incorporation, the By-Laws, any other agreement, any vote of
stockholders or disinterested directors, the General Corporation Law of
Delaware, any other law (common or statutory), or otherwise, both as to action
in the Indemnitee's official capacity and as to action in another capacity while
holding office for the Corporation. Nothing contained in this Agreement shall be
deemed to prohibit the Corporation from purchasing and maintaining insurance, at
its expense, to protect itself or the Indemnitee against any expense, liability
or loss incurred by it or the Indemnitee in any such capacity, or arising out of
the Indemnitee's status as such, whether or not the Indemnitee would be
indemnified against such expense, liability or loss under this Agreement;
provided that the Corporation shall not be liable under this Agreement to make
any payment of amounts otherwise indemnifiable hereunder if and to the extent
that the Indemnitee has otherwise actually received such payment under any
insurance policy, contract, agreement or otherwise.

      12. No Special Rights. Nothing herein shall confer upon the Indemnitee any
right to continue to serve as an officer or director of the Corporation for any
period of time or at any particular rate of compensation.

      13. Savings Clause. If this Agreement or any portion thereof shall be
invalidated on any ground by any court of competent jurisdiction, then the
Corporation shall nevertheless indemnify the Indemnitee as to expenses,
judgments, fines, penalties and amounts paid in settlement with respect to any
Proceeding to the full extent permitted by any applicable portion of this
Agreement that shall not have been invalidated and to the fullest extent
permitted by applicable law.

      14. Counterparts. This Agreement may be executed in any number of
counterparts, each of which shall constitute the original.
<PAGE>
      15. Successors and Assigns. This Agreement shall be binding upon the
Corporation and its successors and assigns and shall inure to the benefit of the
estate, heirs, executors, administrators and personal representatives of the
Indemnitee.

      16. Headings. The headings of the paragraphs of this Agreement are
inserted for convenience only and shall not be deemed to constitute part of this
Agreement or to affect the construction thereof.

      17. Modification and Waiver. This Agreement may be amended from time to
time to reflect changes in Delaware law or for other reasons. No supplement,
modification or amendment of this Agreement shall be binding unless executed in
writing by both of the parties hereto. No waiver of any of the provisions of
this Agreement shall be deemed or shall constitute a waiver of any other
provision hereof nor shall any such waiver constitute a continuing waiver.

      18. Notices. All notices, requests, demands and other communications
hereunder shall be in writing and shall be deemed to have been given (i) when
delivered by hand or (ii) if mailed by certified or registered mail with postage
prepaid, on the third day after the date on which it is so mailed:

                 (a)  if to the Indemnitee, to:  Lawrence D. Lenihan, Jr.
                                                 Pequot Capital Management, Inc.
                                                 153 East 53(rd) Street
                                                 35(th) Floor
                                                 New York, NY 10022


                 (b) if to the Corporation, to:  Netegrity, Inc.
                                                 52 Second Avenue
                                                 Waltham, Massachusetts 02451
                                                 Attention:  General Counsel

or to such other address as may have been furnished to the Indemnitee by the
Corporation or to the Corporation by the Indemnitee, as the case may be.

      19. Applicable Law. This Agreement shall be governed by, and construed and
enforced in accordance with, the laws of the State of Delaware. The Indemnitee
may elect to have the right to indemnification or reimbursement or advancement
of expenses interpreted on the basis of the applicable law in effect at the time
of the occurrence of the event or events giving rise to the applicable
Proceeding, to the extent permitted by law, or on the basis of the applicable
law in effect at the time such indemnification or reimbursement or advancement
of expenses is sought. Such election shall be made, by a notice in writing to
the Corporation, at the time indemnification or reimbursement or advancement of
expenses is sought; provided, however, that if no such notice is given, and if
the General Corporation Law of Delaware is amended, or other Delaware law is
enacted, to permit further indemnification of the directors and officers, then
the Indemnitee shall be indemnified to the fullest extent permitted under the
General Corporation Law, as so amended, or by such other Delaware law, as so
enacted.
<PAGE>
      20. Enforcement. The Corporation expressly confirms and agrees that it has
entered into this Agreement in order to induce the Indemnitee to continue to
serve as an officer or director of the Corporation, and acknowledges that the
Indemnitee is relying upon this Agreement in continuing in such capacity.

      21. Entire Agreement. This Agreement sets forth the entire agreement of
the parties hereto in respect of the subject matter contained herein and
supercedes all prior agreements, whether oral or written, by any officer,
employee or representative of any party hereto in respect of the subject matter
contained herein; and any prior agreement of the parties hereto in respect of
the subject matter contained herein is hereby terminated and cancelled. For
avoidance of doubt, the parties confirm that the foregoing does not apply to or
limit the Indemnitee's rights under Delaware law or the Corporation's
Certificate of Incorporation or By-Laws.

      22. Consent to Suit. In the case of any dispute under or in connection
with this Agreement, the Indemnitee may only bring suit against the Corporation
in the Court of Chancery of the State of Delaware. The Indemnitee hereby
consents to the exclusive jurisdiction and venue of the courts of the State of
Delaware, and the Indemnitee hereby waives any claim the Indemnitee may have at
any time as to forum non conveniens with respect to such venue. The Corporation
shall have the right to institute any legal action arising out of or relating to
this Agreement in any court of competent jurisdiction. Any judgment entered
against either of the parties in any proceeding hereunder may be entered and
enforced by any court of competent jurisdiction.

      IN WITNESS WHEREOF, the parties hereto have caused this Agreement to be
duly executed as of the day and year first above written.

                                    NETEGRITY, INC.


Attest:                             By:    /s/ Regina O. Sommer
By:      ______________________     Name:  Regina O. Sommer
Name: _________________________     Title: Chief Financial Officer and Treasurer

                                    INDEMNITEE:

                                    Lawrence D. Lenihan, Jr.

                                    /s/ Lawrence D. Lenihan, Jr.